Update Skia port to latest Skia version

This commit is contained in:
David Capello 2015-10-02 12:12:37 -03:00
parent e8fde930bd
commit e732297cfb
4 changed files with 27 additions and 16 deletions

View File

@ -48,14 +48,15 @@ public:
wglMakeCurrent(hdc, m_glrc);
fGL.reset(GrGLCreateNativeInterface());
if (!fGL) {
const GrGLInterface* gl = GrGLCreateNativeInterface();
init(gl);
if (!gl) {
ReleaseDC(m_hwnd, hdc);
destroy();
return;
}
if (!fGL->validate()) {
if (!gl->validate()) {
ReleaseDC(m_hwnd, hdc);
destroy();
return;
@ -68,18 +69,22 @@ public:
destroy();
}
void makeCurrent() const override {
void onPlatformMakeCurrent() const override {
HDC hdc = GetDC(m_hwnd);
wglMakeCurrent(hdc, m_glrc);
ReleaseDC(m_hwnd, hdc);
}
void swapBuffers() const override {
void onPlatformSwapBuffers() const override {
HDC hdc = GetDC(m_hwnd);
SwapBuffers(hdc);
ReleaseDC(m_hwnd, hdc);
}
GrGLFuncPtr onPlatformGetProcAddress(const char* name) const override {
return reinterpret_cast<GrGLFuncPtr>(wglGetProcAddress(name));
}
int getStencilBits() {
HDC hdc = GetDC(m_hwnd);
int pixelFormat = GetPixelFormat(hdc);
@ -95,7 +100,7 @@ public:
private:
void destroy() {
fGL.reset(nullptr);
teardown();
if (m_glrc) {
wglMakeCurrent(nullptr, nullptr);

View File

@ -136,7 +136,8 @@ public:
SkCanvas canvas(result);
SkRect srcRect = SkRect::Make(SkIRect::MakeXYWH(0, 0, width(), height()));
SkRect dstRect = SkRect::Make(SkIRect::MakeXYWH(0, 0, result.width(), result.height()));
canvas.drawBitmapRectToRect(m_bitmap, &srcRect, dstRect, &paint);
canvas.drawBitmapRect(m_bitmap, srcRect, dstRect, &paint,
SkCanvas::kStrict_SrcRectConstraint);
swapBitmap(result);
}
@ -307,7 +308,9 @@ public:
SkRect srcRect = SkRect::Make(SkIRect::MakeXYWH(srcx, srcy, width, height));
SkRect dstRect = SkRect::Make(SkIRect::MakeXYWH(dstx, dsty, width, height));
((SkiaSurface*)dest)->m_canvas->drawBitmapRectToRect(m_bitmap, &srcRect, dstRect, &paint);
((SkiaSurface*)dest)->m_canvas->drawBitmapRect(
m_bitmap, srcRect, dstRect, &paint,
SkCanvas::kStrict_SrcRectConstraint);
}
}
@ -363,8 +366,9 @@ public:
SkPaint paint;
paint.setXfermodeMode(SkXfermode::kSrc_Mode);
m_canvas->drawBitmapRectToRect(
((SkiaSurface*)src)->m_bitmap, &srcRect, dstRect, &paint);
m_canvas->drawBitmapRect(
((SkiaSurface*)src)->m_bitmap, srcRect, dstRect, &paint,
SkCanvas::kStrict_SrcRectConstraint);
}
void drawRgbaSurface(const LockedSurface* src, int dstx, int dsty) override {
@ -381,8 +385,9 @@ public:
SkPaint paint;
paint.setXfermodeMode(SkXfermode::kSrcOver_Mode);
m_canvas->drawBitmapRectToRect(
((SkiaSurface*)src)->m_bitmap, &srcRect, dstRect, &paint);
m_canvas->drawBitmapRect(
((SkiaSurface*)src)->m_bitmap, srcRect, dstRect, &paint,
SkCanvas::kStrict_SrcRectConstraint);
}
void drawColoredRgbaSurface(const LockedSurface* src, gfx::Color fg, gfx::Color bg, const gfx::Clip& clipbase) override {
@ -407,9 +412,10 @@ public:
SkColorFilter::CreateModeFilter(to_skia(fg), SkXfermode::kSrcIn_Mode));
paint.setColorFilter(colorFilter);
m_canvas->drawBitmapRectToRect(
m_canvas->drawBitmapRect(
((SkiaSurface*)src)->m_bitmap,
&srcRect, dstRect, &paint);
srcRect, dstRect, &paint,
SkCanvas::kStrict_SrcRectConstraint);
}
void drawChar(Font* font, gfx::Color fg, gfx::Color bg, int x, int y, int chr) override {

View File

@ -82,7 +82,7 @@ public:
Surface* loadSurface(const char* filename) override {
base::FileHandle fp(base::open_file_with_exception(filename, "rb"));
SkAutoTDelete<SkStreamAsset> stream(SkNEW_ARGS(SkFILEStream, (fp.get(), SkFILEStream::kCallerRetains_Ownership)));
SkAutoTDelete<SkStreamAsset> stream(new SkFILEStream(fp.get(), SkFILEStream::kCallerRetains_Ownership));
SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(stream));
if (decoder) {

View File

@ -122,7 +122,7 @@ void SkiaWindow::paintHDC(HDC hdc)
bool SkiaWindow::attachGL()
{
if (!m_glCtx) {
GLContextWGL* wglCtx = SkNEW_ARGS(GLContextWGL, (handle(), kGLES_GrGLStandard));
GLContextWGL* wglCtx = new GLContextWGL(handle(), kGLES_GrGLStandard);
m_stencilBits = wglCtx->getStencilBits();
m_sampleCount = wglCtx->getSampleCount();