diff options
author | Torne (Richard Coles) <torne@google.com> | 2014-12-18 15:59:33 +0000 |
---|---|---|
committer | Torne (Richard Coles) <torne@google.com> | 2014-12-18 15:59:33 +0000 |
commit | c14053143720a0f0dd12a62b0653ccd73e775f56 (patch) | |
tree | 562763fce36d5c94e27609d7ad204451c41622c8 | |
parent | 3d2a46357c7145de26b213e1bbba519e675d8a40 (diff) | |
parent | 38f01f072c1dabf623bcae3aba1dd84eb55287a0 (diff) | |
download | skia-c14053143720a0f0dd12a62b0653ccd73e775f56.tar.gz |
Merge from Chromium at DEPS revision 40.0.2214.45
This commit was generated by merge_to_master.py.
Change-Id: I2727aa7130d490d425674c5001e18accc1de6b46
-rw-r--r-- | src/core/SkPictureShader.cpp | 9 | ||||
-rwxr-xr-x | src/gpu/GrContext.cpp | 7 | ||||
-rw-r--r-- | src/gpu/gl/GrGLRenderTarget.cpp | 5 | ||||
-rw-r--r-- | src/gpu/gl/GrGLRenderTarget.h | 4 | ||||
-rw-r--r-- | src/gpu/gl/GrGLTexture.cpp | 5 | ||||
-rw-r--r-- | src/gpu/gl/GrGLTexture.h | 4 | ||||
-rwxr-xr-x | src/ports/SkFontHost_mac.cpp | 7 |
7 files changed, 33 insertions, 8 deletions
diff --git a/src/core/SkPictureShader.cpp b/src/core/SkPictureShader.cpp index 1f32a7ecd..1596fb3ab 100644 --- a/src/core/SkPictureShader.cpp +++ b/src/core/SkPictureShader.cpp @@ -77,7 +77,14 @@ struct BitmapShaderRec : public SkResourceCache::Rec { SkAutoTUnref<SkShader>* result = reinterpret_cast<SkAutoTUnref<SkShader>*>(contextShader); result->reset(SkRef(rec.fShader.get())); - return true; + + SkBitmap tile; + rec.fShader.get()->asABitmap(&tile, NULL, NULL); + // FIXME: this doesn't protect the pixels from being discarded as soon as we unlock. + // Should be handled via a pixel ref generator instead + // (https://code.google.com/p/skia/issues/detail?id=3220). + SkAutoLockPixels alp(tile, true); + return tile.getPixels() != NULL; } }; diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp index a456a799c..e3b590a93 100755 --- a/src/gpu/GrContext.cpp +++ b/src/gpu/GrContext.cpp @@ -1574,9 +1574,10 @@ void GrContext::copySurface(GrSurface* dst, GrSurface* src, const SkIRect& srcRe } target->copySurface(dst, src, srcRect, dstPoint); - if (kFlushWrites_PixelOp & pixelOpsFlags) { - this->flush(); - } + // always flush, this is not the behavior of TOT Skia but some uses of GrContext copySurface + // in chrome rely on this behavior + // see crbug:440671 + this->flush(); } void GrContext::flushSurfaceWrites(GrSurface* surface) { diff --git a/src/gpu/gl/GrGLRenderTarget.cpp b/src/gpu/gl/GrGLRenderTarget.cpp index 8482ecdc6..2d6c19c04 100644 --- a/src/gpu/gl/GrGLRenderTarget.cpp +++ b/src/gpu/gl/GrGLRenderTarget.cpp @@ -31,6 +31,7 @@ void GrGLRenderTarget::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) { fRTFBOID = idDesc.fRTFBOID; fTexFBOID = idDesc.fTexFBOID; fMSColorRenderbufferID = idDesc.fMSColorRenderbufferID; + fIsWrapped = idDesc.fIsWrapped; fViewport.fLeft = 0; fViewport.fBottom = 0; @@ -54,7 +55,7 @@ size_t GrGLRenderTarget::gpuMemorySize() const { } void GrGLRenderTarget::onRelease() { - if (!this->isWrapped()) { + if (!fIsWrapped) { if (fTexFBOID) { GL_CALL(DeleteFramebuffers(1, &fTexFBOID)); } @@ -68,6 +69,7 @@ void GrGLRenderTarget::onRelease() { fRTFBOID = 0; fTexFBOID = 0; fMSColorRenderbufferID = 0; + fIsWrapped = false; INHERITED::onRelease(); } @@ -75,5 +77,6 @@ void GrGLRenderTarget::onAbandon() { fRTFBOID = 0; fTexFBOID = 0; fMSColorRenderbufferID = 0; + fIsWrapped = false; INHERITED::onAbandon(); } diff --git a/src/gpu/gl/GrGLRenderTarget.h b/src/gpu/gl/GrGLRenderTarget.h index 0f041600e..50e3b5ace 100644 --- a/src/gpu/gl/GrGLRenderTarget.h +++ b/src/gpu/gl/GrGLRenderTarget.h @@ -77,6 +77,10 @@ private: GrGLuint fTexFBOID; GrGLuint fMSColorRenderbufferID; + // We track this separately from GrGpuResource because this may be both a texture and a render + // target, and the texture may be wrapped while the render target is not. + bool fIsWrapped; + // when we switch to this render target we want to set the viewport to // only render to content area (as opposed to the whole allocation) and // we want the rendering to be at top left (GL has origin in bottom left) diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp index 8777d1b75..ce892ddbb 100644 --- a/src/gpu/gl/GrGLTexture.cpp +++ b/src/gpu/gl/GrGLTexture.cpp @@ -30,20 +30,23 @@ void GrGLTexture::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) { fTexParams.invalidate(); fTexParamsTimestamp = GrGpu::kExpiredTimestamp; fTextureID = idDesc.fTextureID; + fIsWrapped = idDesc.fIsWrapped; } void GrGLTexture::onRelease() { if (fTextureID) { - if (!this->isWrapped()) { + if (!fIsWrapped) { GL_CALL(DeleteTextures(1, &fTextureID)); } fTextureID = 0; + fIsWrapped = false; } INHERITED::onRelease(); } void GrGLTexture::onAbandon() { fTextureID = 0; + fIsWrapped = false; INHERITED::onAbandon(); } diff --git a/src/gpu/gl/GrGLTexture.h b/src/gpu/gl/GrGLTexture.h index f23adae0d..c3c396eff 100644 --- a/src/gpu/gl/GrGLTexture.h +++ b/src/gpu/gl/GrGLTexture.h @@ -70,6 +70,10 @@ private: GrGpu::ResetTimestamp fTexParamsTimestamp; GrGLuint fTextureID; + // We track this separately from GrGpuResource because this may be both a texture and a render + // target, and the texture may be wrapped while the render target is not. + bool fIsWrapped; + typedef GrTexture INHERITED; }; diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp index 2f991c861..8c1abc91c 100755 --- a/src/ports/SkFontHost_mac.cpp +++ b/src/ports/SkFontHost_mac.cpp @@ -741,9 +741,12 @@ SkScalerContext_Mac::SkScalerContext_Mac(SkTypeface_Mac* typeface, CGFloat textSize = ScalarToCG(fRec.fTextSize); // If a text size of 0 is requested, CoreGraphics will use 12 instead. - // If the text size is 0, set it to something tiny. + // It would make sense to force the text size to something tiny, + // but this causes assertion failures inside CG (drawing glyphs at CGFLOAT_MIN size). + // Instead, set such tiny sizes to 1, and transform them down to 0 with a singular transform. if (textSize < CGFLOAT_MIN) { - textSize = CGFLOAT_MIN; + textSize = 1; + transform = CGAffineTransformMakeScale(0, 0); } fCTFont.reset(CTFontCreateCopyWithAttributes(ctFont, textSize, &transform, ctFontDesc)); |