aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar reed <reed@chromium.org>2014-06-11 06:09:50 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-06-11 06:09:50 -0700
commite4538f5b46d70798e34eb078f5d5e76a59d02318 (patch)
tree1f90e5aa57adf39857f377113ab43fbbcb0341d5 /src/gpu
parentbae584ab35c5e93679450c60996a0359ca3e727c (diff)
switch to colortype for deepcopy
BUG=skia: R=robertphillips@google.com, bsalomon@google.com, reed@google.com Author: reed@chromium.org Review URL: https://codereview.chromium.org/323283002
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/SkGrPixelRef.cpp21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/gpu/SkGrPixelRef.cpp b/src/gpu/SkGrPixelRef.cpp
index fd21f1073b..2131f41b17 100644
--- a/src/gpu/SkGrPixelRef.cpp
+++ b/src/gpu/SkGrPixelRef.cpp
@@ -51,9 +51,9 @@ bool SkROLockPixelsPixelRef::onLockPixelsAreWritable() const {
///////////////////////////////////////////////////////////////////////////////
-static SkGrPixelRef* copyToTexturePixelRef(GrTexture* texture, SkBitmap::Config dstConfig,
+static SkGrPixelRef* copyToTexturePixelRef(GrTexture* texture, SkColorType dstCT,
const SkIRect* subset) {
- if (NULL == texture) {
+ if (NULL == texture || kUnknown_SkColorType == dstCT) {
return NULL;
}
GrContext* context = texture->getContext();
@@ -77,15 +77,7 @@ static SkGrPixelRef* copyToTexturePixelRef(GrTexture* texture, SkBitmap::Config
topLeft = NULL;
}
desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit;
- desc.fConfig = SkBitmapConfig2GrPixelConfig(dstConfig);
-
- SkImageInfo info;
- if (!GrPixelConfig2ColorType(desc.fConfig, &info.fColorType)) {
- return NULL;
- }
- info.fWidth = desc.fWidth;
- info.fHeight = desc.fHeight;
- info.fAlphaType = kPremul_SkAlphaType;
+ desc.fConfig = SkImageInfo2GrPixelConfig(dstCT, kPremul_SkAlphaType);
GrTexture* dst = context->createUncachedTexture(desc, NULL, 0);
if (NULL == dst) {
@@ -104,6 +96,7 @@ static SkGrPixelRef* copyToTexturePixelRef(GrTexture* texture, SkBitmap::Config
dst->releaseRenderTarget();
#endif
+ SkImageInfo info = SkImageInfo::Make(desc.fWidth, desc.fHeight, dstCT, kPremul_SkAlphaType);
SkGrPixelRef* pixelRef = SkNEW_ARGS(SkGrPixelRef, (info, dst));
SkSafeUnref(dst);
return pixelRef;
@@ -152,18 +145,18 @@ GrTexture* SkGrPixelRef::getTexture() {
return NULL;
}
-SkPixelRef* SkGrPixelRef::deepCopy(SkBitmap::Config dstConfig, const SkIRect* subset) {
+SkPixelRef* SkGrPixelRef::deepCopy(SkColorType dstCT, const SkIRect* subset) {
if (NULL == fSurface) {
return NULL;
}
-
+
// Note that when copying a render-target-backed pixel ref, we
// return a texture-backed pixel ref instead. This is because
// render-target pixel refs are usually created in conjunction with
// a GrTexture owned elsewhere (e.g., SkGpuDevice), and cannot live
// independently of that texture. Texture-backed pixel refs, on the other
// hand, own their GrTextures, and are thus self-contained.
- return copyToTexturePixelRef(fSurface->asTexture(), dstConfig, subset);
+ return copyToTexturePixelRef(fSurface->asTexture(), dstCT, subset);
}
bool SkGrPixelRef::onReadPixels(SkBitmap* dst, const SkIRect* subset) {