Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Side by Side Diff: src/image/SkImage_Raster.cpp

Issue 1903483003: Add onImageInfo call to SkImage_Base. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove ImageInfo changes. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/image/SkImage_Gpu.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 if (minSize) { 68 if (minSize) {
69 *minSize = size; 69 *minSize = size;
70 } 70 }
71 return true; 71 return true;
72 } 72 }
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 {
78 return fBitmap.info();
79 }
80
77 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;
78 bool onPeekPixels(SkPixmap*) const override; 82 bool onPeekPixels(SkPixmap*) const override;
79 SkData* onRefEncoded(GrContext*) const override; 83 SkData* onRefEncoded(GrContext*) const override;
80 bool getROPixels(SkBitmap*, CachingHint) const override; 84 bool getROPixels(SkBitmap*, CachingHint) const override;
81 GrTexture* asTextureRef(GrContext*, const GrTextureParams&) const override; 85 GrTexture* asTextureRef(GrContext*, const GrTextureParams&) const override;
82 sk_sp<SkImage> onMakeSubset(const SkIRect&) const override; 86 sk_sp<SkImage> onMakeSubset(const SkIRect&) const override;
83 87
84 // exposed for SkSurface_Raster via SkNewImageFromPixelRef 88 // exposed for SkSurface_Raster via SkNewImageFromPixelRef
85 SkImage_Raster(const SkImageInfo&, SkPixelRef*, const SkIPoint& origin, size _t rowBytes); 89 SkImage_Raster(const SkImageInfo&, SkPixelRef*, const SkIPoint& origin, size _t rowBytes);
86 90
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } 175 }
172 176
173 GrTexture* SkImage_Raster::asTextureRef(GrContext* ctx, const GrTextureParams& p arams) const { 177 GrTexture* SkImage_Raster::asTextureRef(GrContext* ctx, const GrTextureParams& p arams) const {
174 #if SK_SUPPORT_GPU 178 #if SK_SUPPORT_GPU
175 if (!ctx) { 179 if (!ctx) {
176 return nullptr; 180 return nullptr;
177 } 181 }
178 182
179 return GrRefCachedBitmapTexture(ctx, fBitmap, params); 183 return GrRefCachedBitmapTexture(ctx, fBitmap, params);
180 #endif 184 #endif
181 185
182 return nullptr; 186 return nullptr;
183 } 187 }
184 188
185 sk_sp<SkImage> SkImage_Raster::onMakeSubset(const SkIRect& subset) const { 189 sk_sp<SkImage> SkImage_Raster::onMakeSubset(const SkIRect& subset) const {
186 // TODO : could consider heurist of sharing pixels, if subset is pretty clos e to complete 190 // TODO : could consider heurist of sharing pixels, if subset is pretty clos e to complete
187 191
188 SkImageInfo info = SkImageInfo::MakeN32(subset.width(), subset.height(), fBi tmap.alphaType()); 192 SkImageInfo info = SkImageInfo::MakeN32(subset.width(), subset.height(), fBi tmap.alphaType());
189 auto surface(SkSurface::MakeRaster(info)); 193 auto surface(SkSurface::MakeRaster(info));
190 if (!surface) { 194 if (!surface) {
191 return nullptr; 195 return nullptr;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 // pixelref since the caller might call setImmutable() themselves 292 // pixelref since the caller might call setImmutable() themselves
289 // (thus changing our state). 293 // (thus changing our state).
290 if (fBitmap.isImmutable()) { 294 if (fBitmap.isImmutable()) {
291 bitmap->setInfo(fBitmap.info(), fBitmap.rowBytes()); 295 bitmap->setInfo(fBitmap.info(), fBitmap.rowBytes());
292 bitmap->setPixelRef(fBitmap.pixelRef(), fBitmap.pixelRefOrigin()); 296 bitmap->setPixelRef(fBitmap.pixelRef(), fBitmap.pixelRefOrigin());
293 return true; 297 return true;
294 } 298 }
295 } 299 }
296 return this->INHERITED::onAsLegacyBitmap(bitmap, mode); 300 return this->INHERITED::onAsLegacyBitmap(bitmap, mode);
297 } 301 }
OLDNEW
« no previous file with comments | « src/image/SkImage_Gpu.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698