aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-06-23 14:38:48 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-06-23 14:38:48 -0700
commit74f681dce2fbadd481596aea15afb3e0fb36ceff (patch)
tree86093c4896eeddbbc33283288fbebb21996fce13 /src/image
parent5fbb623099a6d0e0e72e7e230e75014fd64ae240 (diff)
Make SkGpuDevice know its alpha type
Make SkImage_Gpu snapshots opaque if surface is opaque. BUG=skia:3965 Review URL: https://codereview.chromium.org/1205643002
Diffstat (limited to 'src/image')
-rw-r--r--src/image/SkImage_Gpu.cpp2
-rw-r--r--src/image/SkSurface_Gpu.cpp8
2 files changed, 6 insertions, 4 deletions
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 973f4ba304..4003631c8a 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -61,7 +61,7 @@ bool SkImage_Gpu::getROPixels(SkBitmap* dst) const {
}
bool SkImage_Gpu::isOpaque() const {
- return GrPixelConfigIsOpaque(fTexture->config());
+ return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaque_SkAlphaType;
}
static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes) {
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index cbc183eacf..fa006a61cd 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -83,7 +83,8 @@ void SkSurface_Gpu::onDiscard() {
///////////////////////////////////////////////////////////////////////////////
SkSurface* SkSurface::NewRenderTargetDirect(GrRenderTarget* target, const SkSurfaceProps* props) {
- SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(target, props));
+ SkAutoTUnref<SkGpuDevice> device(
+ SkGpuDevice::Create(target, props, SkGpuDevice::kUninit_InitContents));
if (!device) {
return NULL;
}
@@ -93,7 +94,7 @@ SkSurface* SkSurface::NewRenderTargetDirect(GrRenderTarget* target, const SkSurf
SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, Budgeted budgeted, const SkImageInfo& info,
int sampleCount, const SkSurfaceProps* props) {
SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(ctx, budgeted, info, sampleCount, props,
- SkGpuDevice::kNeedClear_Flag));
+ SkGpuDevice::kClear_InitContents));
if (!device) {
return NULL;
}
@@ -113,7 +114,8 @@ SkSurface* SkSurface::NewWrappedRenderTarget(GrContext* context, GrBackendTextur
if (!surface) {
return NULL;
}
- SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget(), props));
+ SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget(), props,
+ SkGpuDevice::kUninit_InitContents));
if (!device) {
return NULL;
}