Minor Ganesh refFoo cleanup
authorRobert Phillips <robertphillips@google.com>
Fri, 13 Jan 2017 16:21:36 +0000 (11:21 -0500)
committerSkia Commit-Bot <skia-commit-bot@chromium.org>
Fri, 13 Jan 2017 17:15:18 +0000 (17:15 +0000)
Change-Id: I2c66693c280225795a5d36ccc0391fcd4056420d
Reviewed-on: https://skia-review.googlesource.com/6995
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>

include/core/SkBitmap.h
src/gpu/SkGpuDevice.cpp
src/gpu/SkGr.cpp

index 4d2af43..08faaaf 100644 (file)
@@ -85,6 +85,7 @@ public:
     SkColorType colorType() const { return fInfo.colorType(); }
     SkAlphaType alphaType() const { return fInfo.alphaType(); }
     SkColorSpace* colorSpace() const { return fInfo.colorSpace(); }
+    sk_sp<SkColorSpace> refColorSpace() const { return fInfo.refColorSpace(); }
 
     /**
      *  Return the number of bytes per pixel based on the colortype. If the colortype is
index f25c472..bf9341f 100644 (file)
@@ -166,7 +166,7 @@ sk_sp<GrRenderTargetContext> SkGpuDevice::MakeRenderTargetContext(
     GrPixelConfig config = SkImageInfo2GrPixelConfig(origInfo, *context->caps());
     return context->makeRenderTargetContext(SkBackingFit::kExact,               // Why exact?
                                     origInfo.width(), origInfo.height(),
-                                    config, sk_ref_sp(origInfo.colorSpace()), sampleCount,
+                                    config, origInfo.refColorSpace(), sampleCount,
                                     origin, surfaceProps, budgeted);
 }
 
@@ -1128,7 +1128,7 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
     sk_sp<SkSpecialImage> srcImg(SkSpecialImage::MakeFromGpu(srcRect,
                                                              bitmap.getGenerationID(),
                                                              std::move(texture),
-                                                             sk_ref_sp(bitmap.colorSpace()),
+                                                             bitmap.refColorSpace(),
                                                              &this->surfaceProps()));
 
     this->drawSpecial(draw, srcImg.get(), left, top, paint);
@@ -1291,7 +1291,7 @@ sk_sp<SkSpecialImage> SkGpuDevice::makeSpecial(const SkBitmap& bitmap) {
     return SkSpecialImage::MakeFromGpu(bitmap.bounds(),
                                        bitmap.getGenerationID(),
                                        texture,
-                                       sk_ref_sp(bitmap.colorSpace()),
+                                       bitmap.refColorSpace(),
                                        &this->surfaceProps());
 }
 
@@ -1303,7 +1303,7 @@ sk_sp<SkSpecialImage> SkGpuDevice::makeSpecial(const SkImage* image) {
         return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(image->width(), image->height()),
                                            image->uniqueID(),
                                            sk_ref_sp(texture),
-                                           sk_ref_sp(as_IB(image)->onImageInfo().colorSpace()),
+                                           as_IB(image)->onImageInfo().refColorSpace(),
                                            &this->surfaceProps());
     } else if (image->peekPixels(&pm)) {
         SkBitmap bm;
@@ -1336,7 +1336,7 @@ sk_sp<SkSpecialImage> SkGpuDevice::snapSpecial() {
                                                srcRect,
                                                kNeedNewImageUniqueID_SpecialImage,
                                                sProxy,
-                                               sk_ref_sp(ii.colorSpace()),
+                                               ii.refColorSpace(),
                                                &this->surfaceProps());
 }
 
index eec3cd7..f3b9008 100644 (file)
@@ -188,7 +188,7 @@ GrTexture* GrUploadPixmapToTexture(GrContext* ctx, const SkPixmap& pixmap, SkBud
 
         SkImageInfo dstInfo = SkImageInfo::Make(pixmap.width(), pixmap.height(),
                                                 kN32_SkColorType, kPremul_SkAlphaType,
-                                                sk_ref_sp(pixmap.info().colorSpace()));
+                                                pixmap.info().refColorSpace());
 
         tmpBitmap.allocPixels(dstInfo);