OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkImage_Base.h" | 8 #include "SkImage_Base.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 SkImage_Raster(const SkImageInfo&, sk_sp<SkData>, size_t rb, SkColorTable*); | 74 SkImage_Raster(const SkImageInfo&, sk_sp<SkData>, size_t rb, SkColorTable*); |
75 virtual ~SkImage_Raster(); | 75 virtual ~SkImage_Raster(); |
76 | 76 |
77 SkImageInfo onImageInfo() const override { | 77 SkImageInfo onImageInfo() const override { |
78 return fBitmap.info(); | 78 return fBitmap.info(); |
79 } | 79 } |
80 | 80 |
81 bool onReadPixels(const SkImageInfo&, void*, size_t, int srcX, int srcY, Cac
hingHint) const override; | 81 bool onReadPixels(const SkImageInfo&, void*, size_t, int srcX, int srcY, Cac
hingHint) const override; |
82 bool onPeekPixels(SkPixmap*) const override; | 82 bool onPeekPixels(SkPixmap*) const override; |
| 83 const SkBitmap* onPeekBitmap() const override { return &fBitmap; } |
| 84 |
83 SkData* onRefEncoded(GrContext*) const override; | 85 SkData* onRefEncoded(GrContext*) const override; |
84 bool getROPixels(SkBitmap*, CachingHint) const override; | 86 bool getROPixels(SkBitmap*, CachingHint) const override; |
85 GrTexture* asTextureRef(GrContext*, const GrTextureParams&, | 87 GrTexture* asTextureRef(GrContext*, const GrTextureParams&, |
86 SkSourceGammaTreatment) const override; | 88 SkSourceGammaTreatment) const override; |
87 sk_sp<SkImage> onMakeSubset(const SkIRect&) const override; | 89 sk_sp<SkImage> onMakeSubset(const SkIRect&) const override; |
88 | 90 |
89 // exposed for SkSurface_Raster via SkNewImageFromPixelRef | 91 // exposed for SkSurface_Raster via SkNewImageFromPixelRef |
90 SkImage_Raster(const SkImageInfo&, SkPixelRef*, const SkIPoint& origin, size
_t rowBytes); | 92 SkImage_Raster(const SkImageInfo&, SkPixelRef*, const SkIPoint& origin, size
_t rowBytes); |
91 | 93 |
92 SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); } | 94 SkPixelRef* getPixelRef() const { return fBitmap.pixelRef(); } |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 // pixelref since the caller might call setImmutable() themselves | 294 // pixelref since the caller might call setImmutable() themselves |
293 // (thus changing our state). | 295 // (thus changing our state). |
294 if (fBitmap.isImmutable()) { | 296 if (fBitmap.isImmutable()) { |
295 bitmap->setInfo(fBitmap.info(), fBitmap.rowBytes()); | 297 bitmap->setInfo(fBitmap.info(), fBitmap.rowBytes()); |
296 bitmap->setPixelRef(fBitmap.pixelRef(), fBitmap.pixelRefOrigin()); | 298 bitmap->setPixelRef(fBitmap.pixelRef(), fBitmap.pixelRefOrigin()); |
297 return true; | 299 return true; |
298 } | 300 } |
299 } | 301 } |
300 return this->INHERITED::onAsLegacyBitmap(bitmap, mode); | 302 return this->INHERITED::onAsLegacyBitmap(bitmap, mode); |
301 } | 303 } |
OLD | NEW |