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

Side by Side Diff: src/core/SkSpecialImage.cpp

Issue 1845283003: Gamma-correctness pushed into Skia, top-down. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase 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
OLDNEW
1 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 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 #include "SkSpecialImage.h" 7 #include "SkSpecialImage.h"
8 8
9 #if SK_SUPPORT_GPU 9 #if SK_SUPPORT_GPU
10 #include "GrTexture.h" 10 #include "GrTexture.h"
11 #include "GrTextureParams.h" 11 #include "GrTextureParams.h"
12 #include "SkGr.h" 12 #include "SkGr.h"
13 #endif 13 #endif
14 14
15 #include "SkCanvas.h" 15 #include "SkCanvas.h"
16 #include "SkImage_Base.h" 16 #include "SkImage_Base.h"
17 #include "SkSpecialSurface.h" 17 #include "SkSpecialSurface.h"
18 #include "SkSurfacePriv.h"
18 19
19 /////////////////////////////////////////////////////////////////////////////// 20 ///////////////////////////////////////////////////////////////////////////////
20 class SkSpecialImage_Base : public SkSpecialImage { 21 class SkSpecialImage_Base : public SkSpecialImage {
21 public: 22 public:
22 SkSpecialImage_Base(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint 32_t uniqueID) 23 SkSpecialImage_Base(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint 32_t uniqueID,
23 : INHERITED(proxy, subset, uniqueID) { 24 const SkSurfaceProps* props)
25 : INHERITED(proxy, subset, uniqueID, props) {
24 } 26 }
25 virtual ~SkSpecialImage_Base() { } 27 virtual ~SkSpecialImage_Base() { }
26 28
27 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const = 0; 29 virtual void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const = 0;
28 30
29 virtual bool onPeekPixels(SkPixmap*) const { return false; } 31 virtual bool onPeekPixels(SkPixmap*) const { return false; }
30 32
31 virtual GrTexture* onPeekTexture() const { return nullptr; } 33 virtual GrTexture* onPeekTexture() const { return nullptr; }
32 34
33 virtual bool testingOnlyOnGetROPixels(SkBitmap*) const = 0; 35 virtual bool testingOnlyOnGetROPixels(SkBitmap*) const = 0;
(...skipping 11 matching lines...) Expand all
45 47
46 private: 48 private:
47 typedef SkSpecialImage INHERITED; 49 typedef SkSpecialImage INHERITED;
48 }; 50 };
49 51
50 /////////////////////////////////////////////////////////////////////////////// 52 ///////////////////////////////////////////////////////////////////////////////
51 static inline const SkSpecialImage_Base* as_SIB(const SkSpecialImage* image) { 53 static inline const SkSpecialImage_Base* as_SIB(const SkSpecialImage* image) {
52 return static_cast<const SkSpecialImage_Base*>(image); 54 return static_cast<const SkSpecialImage_Base*>(image);
53 } 55 }
54 56
57 SkSpecialImage::SkSpecialImage(SkImageFilter::Proxy* proxy,
58 const SkIRect& subset,
59 uint32_t uniqueID,
60 const SkSurfaceProps* props)
61 : fProps(SkSurfacePropsCopyOrDefault(props))
62 , fSubset(subset)
63 , fUniqueID(kNeedNewImageUniqueID_SpecialImage == uniqueID ? SkNextID::Image ID() : uniqueID)
64 , fProxy(proxy) {
65 }
66
55 sk_sp<SkSpecialImage> SkSpecialImage::makeTextureImage(SkImageFilter::Proxy* pro xy, 67 sk_sp<SkSpecialImage> SkSpecialImage::makeTextureImage(SkImageFilter::Proxy* pro xy,
56 GrContext* context) { 68 GrContext* context) {
57 #if SK_SUPPORT_GPU 69 #if SK_SUPPORT_GPU
58 if (!context) { 70 if (!context) {
59 return nullptr; 71 return nullptr;
60 } 72 }
61 if (GrTexture* peek = as_SIB(this)->peekTexture()) { 73 if (GrTexture* peek = as_SIB(this)->peekTexture()) {
62 return peek->getContext() == context ? sk_sp<SkSpecialImage>(SkRef(this) ) : nullptr; 74 return peek->getContext() == context ? sk_sp<SkSpecialImage>(SkRef(this) ) : nullptr;
63 } 75 }
64 76
65 SkBitmap bmp; 77 SkBitmap bmp;
66 if (!this->internal_getBM(&bmp)) { 78 if (!this->internal_getBM(&bmp)) {
67 return nullptr; 79 return nullptr;
68 } 80 }
69 81
70 if (bmp.empty()) { 82 if (bmp.empty()) {
71 return SkSpecialImage::MakeFromRaster(proxy, SkIRect::MakeEmpty(), bmp); 83 return SkSpecialImage::MakeFromRaster(proxy, SkIRect::MakeEmpty(), bmp, &this->props());
72 } 84 }
73 85
74 SkAutoTUnref<GrTexture> resultTex( 86 SkAutoTUnref<GrTexture> resultTex(
75 GrRefCachedBitmapTexture(context, bmp, GrTextureParams::ClampNoFilter()) ); 87 GrRefCachedBitmapTexture(context, bmp, GrTextureParams::ClampNoFilter()) );
76 if (!resultTex) { 88 if (!resultTex) {
77 return nullptr; 89 return nullptr;
78 } 90 }
79 91
80 SkAlphaType at = this->isOpaque() ? kOpaque_SkAlphaType : kPremul_SkAlphaTyp e; 92 SkAlphaType at = this->isOpaque() ? kOpaque_SkAlphaType : kPremul_SkAlphaTyp e;
81 93
82 return SkSpecialImage::MakeFromGpu(proxy, 94 return SkSpecialImage::MakeFromGpu(proxy,
83 SkIRect::MakeWH(resultTex->width(), resul tTex->height()), 95 SkIRect::MakeWH(resultTex->width(), resul tTex->height()),
84 this->uniqueID(), 96 this->uniqueID(),
85 resultTex, at); 97 resultTex, &this->props(), at);
86 #else 98 #else
87 return nullptr; 99 return nullptr;
88 #endif 100 #endif
89 } 101 }
90 102
91 void SkSpecialImage::draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPain t* paint) const { 103 void SkSpecialImage::draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPain t* paint) const {
92 return as_SIB(this)->onDraw(canvas, x, y, paint); 104 return as_SIB(this)->onDraw(canvas, x, y, paint);
93 } 105 }
94 106
95 bool SkSpecialImage::peekPixels(SkPixmap* pixmap) const { 107 bool SkSpecialImage::peekPixels(SkPixmap* pixmap) const {
(...skipping 23 matching lines...) Expand all
119 sk_sp<SkImage> SkSpecialImage::makeTightSubset(const SkIRect& subset) const { 131 sk_sp<SkImage> SkSpecialImage::makeTightSubset(const SkIRect& subset) const {
120 return as_SIB(this)->onMakeTightSubset(subset); 132 return as_SIB(this)->onMakeTightSubset(subset);
121 } 133 }
122 134
123 #if SK_SUPPORT_GPU 135 #if SK_SUPPORT_GPU
124 #include "SkGr.h" 136 #include "SkGr.h"
125 #include "SkGrPixelRef.h" 137 #include "SkGrPixelRef.h"
126 #endif 138 #endif
127 139
128 sk_sp<SkSpecialImage> SkSpecialImage::internal_fromBM(SkImageFilter::Proxy* prox y, 140 sk_sp<SkSpecialImage> SkSpecialImage::internal_fromBM(SkImageFilter::Proxy* prox y,
129 const SkBitmap& src) { 141 const SkBitmap& src,
142 const SkSurfaceProps* prop s) {
130 // Need to test offset case! (see skbug.com/4967) 143 // Need to test offset case! (see skbug.com/4967)
131 if (src.getTexture()) { 144 if (src.getTexture()) {
132 return SkSpecialImage::MakeFromGpu(proxy, 145 return SkSpecialImage::MakeFromGpu(proxy,
133 src.bounds(), 146 src.bounds(),
134 src.getGenerationID(), 147 src.getGenerationID(),
135 src.getTexture()); 148 src.getTexture(),
149 props);
136 } 150 }
137 151
138 return SkSpecialImage::MakeFromRaster(proxy, src.bounds(), src); 152 return SkSpecialImage::MakeFromRaster(proxy, src.bounds(), src, props);
139 } 153 }
140 154
141 bool SkSpecialImage::internal_getBM(SkBitmap* result) { 155 bool SkSpecialImage::internal_getBM(SkBitmap* result) {
142 const SkSpecialImage_Base* ib = as_SIB(this); 156 const SkSpecialImage_Base* ib = as_SIB(this);
143 157
144 // TODO: need to test offset case! (see skbug.com/4967) 158 // TODO: need to test offset case! (see skbug.com/4967)
145 return ib->getBitmapDeprecated(result); 159 return ib->getBitmapDeprecated(result);
146 } 160 }
147 161
148 SkImageFilter::Proxy* SkSpecialImage::internal_getProxy() const { 162 SkImageFilter::Proxy* SkSpecialImage::internal_getProxy() const {
149 return fProxy; 163 return fProxy;
150 } 164 }
151 165
152 /////////////////////////////////////////////////////////////////////////////// 166 ///////////////////////////////////////////////////////////////////////////////
153 #include "SkImage.h" 167 #include "SkImage.h"
154 #if SK_SUPPORT_GPU 168 #if SK_SUPPORT_GPU
155 #include "GrContext.h" 169 #include "GrContext.h"
156 #include "SkGrPriv.h" 170 #include "SkGrPriv.h"
157 #endif 171 #endif
158 172
159 class SkSpecialImage_Image : public SkSpecialImage_Base { 173 class SkSpecialImage_Image : public SkSpecialImage_Base {
160 public: 174 public:
161 SkSpecialImage_Image(SkImageFilter::Proxy* proxy, 175 SkSpecialImage_Image(SkImageFilter::Proxy* proxy,
162 const SkIRect& subset, 176 const SkIRect& subset,
163 sk_sp<SkImage> image) 177 sk_sp<SkImage> image,
164 : INHERITED(proxy, subset, image->uniqueID()) 178 const SkSurfaceProps* props)
179 : INHERITED(proxy, subset, image->uniqueID(), props)
165 , fImage(image) { 180 , fImage(image) {
166 } 181 }
167 182
168 ~SkSpecialImage_Image() override { } 183 ~SkSpecialImage_Image() override { }
169 184
170 bool isOpaque() const override { return fImage->isOpaque(); } 185 bool isOpaque() const override { return fImage->isOpaque(); }
171 186
172 size_t getSize() const override { 187 size_t getSize() const override {
173 #if SK_SUPPORT_GPU 188 #if SK_SUPPORT_GPU
174 if (GrTexture* texture = as_IB(fImage.get())->peekTexture()) { 189 if (GrTexture* texture = as_IB(fImage.get())->peekTexture()) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 } 248 }
234 249
235 sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override { 250 sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override {
236 sk_sp<SkImage> subsetImg(fImage->makeSubset(subset)); 251 sk_sp<SkImage> subsetImg(fImage->makeSubset(subset));
237 if (!subsetImg) { 252 if (!subsetImg) {
238 return nullptr; 253 return nullptr;
239 } 254 }
240 255
241 return SkSpecialImage::MakeFromImage(this->internal_getProxy(), 256 return SkSpecialImage::MakeFromImage(this->internal_getProxy(),
242 SkIRect::MakeWH(subset.width(), sub set.height()), 257 SkIRect::MakeWH(subset.width(), sub set.height()),
243 subsetImg); 258 subsetImg,
259 &this->props());
244 } 260 }
245 261
246 sk_sp<SkImage> onMakeTightSubset(const SkIRect& subset) const override { 262 sk_sp<SkImage> onMakeTightSubset(const SkIRect& subset) const override {
247 return fImage->makeSubset(subset); 263 return fImage->makeSubset(subset);
248 } 264 }
249 265
250 sk_sp<SkSurface> onMakeTightSurface(const SkImageInfo& info) const override { 266 sk_sp<SkSurface> onMakeTightSurface(const SkImageInfo& info) const override {
251 #if SK_SUPPORT_GPU 267 #if SK_SUPPORT_GPU
252 GrTexture* texture = as_IB(fImage.get())->peekTexture(); 268 GrTexture* texture = as_IB(fImage.get())->peekTexture();
253 if (texture) { 269 if (texture) {
(...skipping 18 matching lines...) Expand all
272 288
273 return rect.fLeft >= 0 && rect.fLeft < width && rect.fLeft < rect.fRight && 289 return rect.fLeft >= 0 && rect.fLeft < width && rect.fLeft < rect.fRight &&
274 rect.fRight >= 0 && rect.fRight <= width && 290 rect.fRight >= 0 && rect.fRight <= width &&
275 rect.fTop >= 0 && rect.fTop < height && rect.fTop < rect.fBottom && 291 rect.fTop >= 0 && rect.fTop < height && rect.fTop < rect.fBottom &&
276 rect.fBottom >= 0 && rect.fBottom <= height; 292 rect.fBottom >= 0 && rect.fBottom <= height;
277 } 293 }
278 #endif 294 #endif
279 295
280 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromImage(SkImageFilter::Proxy* proxy, 296 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromImage(SkImageFilter::Proxy* proxy,
281 const SkIRect& subset, 297 const SkIRect& subset,
282 sk_sp<SkImage> image) { 298 sk_sp<SkImage> image,
299 const SkSurfaceProps* props) {
283 SkASSERT(rect_fits(subset, image->width(), image->height())); 300 SkASSERT(rect_fits(subset, image->width(), image->height()));
284 301
285 return sk_make_sp<SkSpecialImage_Image>(proxy, subset, image); 302 return sk_make_sp<SkSpecialImage_Image>(proxy, subset, image, props);
286 } 303 }
287 304
288 /////////////////////////////////////////////////////////////////////////////// 305 ///////////////////////////////////////////////////////////////////////////////
289 #include "SkBitmap.h" 306 #include "SkBitmap.h"
290 #include "SkImageInfo.h" 307 #include "SkImageInfo.h"
291 #include "SkPixelRef.h" 308 #include "SkPixelRef.h"
292 309
293 class SkSpecialImage_Raster : public SkSpecialImage_Base { 310 class SkSpecialImage_Raster : public SkSpecialImage_Base {
294 public: 311 public:
295 SkSpecialImage_Raster(SkImageFilter::Proxy* proxy, const SkIRect& subset, co nst SkBitmap& bm) 312 SkSpecialImage_Raster(SkImageFilter::Proxy* proxy, const SkIRect& subset, co nst SkBitmap& bm,
296 : INHERITED(proxy, subset, bm.getGenerationID()) 313 const SkSurfaceProps* props)
314 : INHERITED(proxy, subset, bm.getGenerationID(), props)
297 , fBitmap(bm) { 315 , fBitmap(bm) {
298 if (bm.pixelRef() && bm.pixelRef()->isPreLocked()) { 316 if (bm.pixelRef() && bm.pixelRef()->isPreLocked()) {
299 // we only preemptively lock if there is no chance of triggering som ething expensive 317 // we only preemptively lock if there is no chance of triggering som ething expensive
300 // like a lazy decode or imagegenerator. PreLocked means it is flat pixels already. 318 // like a lazy decode or imagegenerator. PreLocked means it is flat pixels already.
301 fBitmap.lockPixels(); 319 fBitmap.lockPixels();
302 } 320 }
303 } 321 }
304 322
305 SkSpecialImage_Raster(SkImageFilter::Proxy* proxy, 323 SkSpecialImage_Raster(SkImageFilter::Proxy* proxy,
306 const SkIRect& subset, 324 const SkIRect& subset,
307 const SkPixmap& pixmap, 325 const SkPixmap& pixmap,
308 RasterReleaseProc releaseProc, 326 RasterReleaseProc releaseProc,
309 ReleaseContext context) 327 ReleaseContext context,
310 : INHERITED(proxy, subset, kNeedNewImageUniqueID_SpecialImage) { 328 const SkSurfaceProps* props)
329 : INHERITED(proxy, subset, kNeedNewImageUniqueID_SpecialImage, props) {
311 fBitmap.installPixels(pixmap.info(), pixmap.writable_addr(), 330 fBitmap.installPixels(pixmap.info(), pixmap.writable_addr(),
312 pixmap.rowBytes(), pixmap.ctable(), 331 pixmap.rowBytes(), pixmap.ctable(),
313 releaseProc, context); 332 releaseProc, context);
314 } 333 }
315 334
316 ~SkSpecialImage_Raster() override { } 335 ~SkSpecialImage_Raster() override { }
317 336
318 bool isOpaque() const override { return fBitmap.isOpaque(); } 337 bool isOpaque() const override { return fBitmap.isOpaque(); }
319 338
320 size_t getSize() const override { return fBitmap.getSize(); } 339 size_t getSize() const override { return fBitmap.getSize(); }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 376
358 sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override { 377 sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override {
359 SkBitmap subsetBM; 378 SkBitmap subsetBM;
360 379
361 if (!fBitmap.extractSubset(&subsetBM, subset)) { 380 if (!fBitmap.extractSubset(&subsetBM, subset)) {
362 return nullptr; 381 return nullptr;
363 } 382 }
364 383
365 return SkSpecialImage::MakeFromRaster(this->internal_getProxy(), 384 return SkSpecialImage::MakeFromRaster(this->internal_getProxy(),
366 SkIRect::MakeWH(subset.width(), su bset.height()), 385 SkIRect::MakeWH(subset.width(), su bset.height()),
367 subsetBM); 386 subsetBM,
387 &this->props());
368 } 388 }
369 389
370 sk_sp<SkImage> onMakeTightSubset(const SkIRect& subset) const override { 390 sk_sp<SkImage> onMakeTightSubset(const SkIRect& subset) const override {
371 SkBitmap subsetBM; 391 SkBitmap subsetBM;
372 392
373 if (!fBitmap.extractSubset(&subsetBM, subset)) { 393 if (!fBitmap.extractSubset(&subsetBM, subset)) {
374 return nullptr; 394 return nullptr;
375 } 395 }
376 396
377 return SkImage::MakeFromBitmap(subsetBM); 397 return SkImage::MakeFromBitmap(subsetBM);
378 } 398 }
379 399
380 sk_sp<SkSurface> onMakeTightSurface(const SkImageInfo& info) const override { 400 sk_sp<SkSurface> onMakeTightSurface(const SkImageInfo& info) const override {
381 return SkSurface::MakeRaster(info); 401 return SkSurface::MakeRaster(info);
382 } 402 }
383 403
384 private: 404 private:
385 SkBitmap fBitmap; 405 SkBitmap fBitmap;
386 406
387 typedef SkSpecialImage_Base INHERITED; 407 typedef SkSpecialImage_Base INHERITED;
388 }; 408 };
389 409
390 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromRaster(SkImageFilter::Proxy* proxy , 410 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromRaster(SkImageFilter::Proxy* proxy ,
391 const SkIRect& subset, 411 const SkIRect& subset,
392 const SkBitmap& bm) { 412 const SkBitmap& bm,
413 const SkSurfaceProps* props ) {
393 SkASSERT(nullptr == bm.getTexture()); 414 SkASSERT(nullptr == bm.getTexture());
394 SkASSERT(rect_fits(subset, bm.width(), bm.height())); 415 SkASSERT(rect_fits(subset, bm.width(), bm.height()));
395 416
396 return sk_make_sp<SkSpecialImage_Raster>(proxy, subset, bm); 417 return sk_make_sp<SkSpecialImage_Raster>(proxy, subset, bm, props);
397 } 418 }
398 419
399 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromPixmap(SkImageFilter::Proxy* proxy , 420 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromPixmap(SkImageFilter::Proxy* proxy ,
400 const SkIRect& subset, 421 const SkIRect& subset,
401 const SkPixmap& src, 422 const SkPixmap& src,
402 RasterReleaseProc releasePr oc, 423 RasterReleaseProc releasePr oc,
403 ReleaseContext context) { 424 ReleaseContext context,
425 const SkSurfaceProps* props ) {
404 if (!src.addr()) { 426 if (!src.addr()) {
405 return nullptr; 427 return nullptr;
406 } 428 }
407 429
408 return sk_make_sp<SkSpecialImage_Raster>(proxy, subset, src, releaseProc, co ntext); 430 return sk_make_sp<SkSpecialImage_Raster>(proxy, subset, src, releaseProc, co ntext, props);
409 } 431 }
410 432
411 433
412 #if SK_SUPPORT_GPU 434 #if SK_SUPPORT_GPU
413 /////////////////////////////////////////////////////////////////////////////// 435 ///////////////////////////////////////////////////////////////////////////////
414 #include "GrTexture.h" 436 #include "GrTexture.h"
415 #include "SkImage_Gpu.h" 437 #include "SkImage_Gpu.h"
416 438
417 class SkSpecialImage_Gpu : public SkSpecialImage_Base { 439 class SkSpecialImage_Gpu : public SkSpecialImage_Base {
418 public: 440 public:
419 SkSpecialImage_Gpu(SkImageFilter::Proxy* proxy, const SkIRect& subset, 441 SkSpecialImage_Gpu(SkImageFilter::Proxy* proxy, const SkIRect& subset,
420 uint32_t uniqueID, GrTexture* tex, SkAlphaType at) 442 uint32_t uniqueID, GrTexture* tex, SkAlphaType at,
421 : INHERITED(proxy, subset, uniqueID) 443 const SkSurfaceProps* props)
444 : INHERITED(proxy, subset, uniqueID, props)
422 , fTexture(SkRef(tex)) 445 , fTexture(SkRef(tex))
423 , fAlphaType(at) { 446 , fAlphaType(at) {
424 } 447 }
425 448
426 ~SkSpecialImage_Gpu() override { } 449 ~SkSpecialImage_Gpu() override { }
427 450
428 bool isOpaque() const override { 451 bool isOpaque() const override {
429 return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaqu e_SkAlphaType; 452 return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaqu e_SkAlphaType;
430 } 453 }
431 454
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 desc.fFlags = kRenderTarget_GrSurfaceFlag; 512 desc.fFlags = kRenderTarget_GrSurfaceFlag;
490 513
491 return SkSpecialSurface::MakeRenderTarget(this->proxy(), fTexture->getCo ntext(), desc); 514 return SkSpecialSurface::MakeRenderTarget(this->proxy(), fTexture->getCo ntext(), desc);
492 } 515 }
493 516
494 sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override { 517 sk_sp<SkSpecialImage> onMakeSubset(const SkIRect& subset) const override {
495 return SkSpecialImage::MakeFromGpu(this->internal_getProxy(), 518 return SkSpecialImage::MakeFromGpu(this->internal_getProxy(),
496 subset, 519 subset,
497 this->uniqueID(), 520 this->uniqueID(),
498 fTexture, 521 fTexture,
522 &this->props(),
499 fAlphaType); 523 fAlphaType);
500 } 524 }
501 525
502 sk_sp<SkImage> onMakeTightSubset(const SkIRect& subset) const override { 526 sk_sp<SkImage> onMakeTightSubset(const SkIRect& subset) const override {
503 if (0 == subset.fLeft && 0 == subset.fTop && 527 if (0 == subset.fLeft && 0 == subset.fTop &&
504 fTexture->width() == subset.width() && 528 fTexture->width() == subset.width() &&
505 fTexture->height() == subset.height()) { 529 fTexture->height() == subset.height()) {
506 // The existing GrTexture is already tight so reuse it in the SkImag e 530 // The existing GrTexture is already tight so reuse it in the SkImag e
507 return sk_make_sp<SkImage_Gpu>(fTexture->width(), fTexture->height() , 531 return sk_make_sp<SkImage_Gpu>(fTexture->width(), fTexture->height() ,
508 kNeedNewImageUniqueID, 532 kNeedNewImageUniqueID,
(...skipping 23 matching lines...) Expand all
532 SkAutoTUnref<GrTexture> fTexture; 556 SkAutoTUnref<GrTexture> fTexture;
533 const SkAlphaType fAlphaType; 557 const SkAlphaType fAlphaType;
534 558
535 typedef SkSpecialImage_Base INHERITED; 559 typedef SkSpecialImage_Base INHERITED;
536 }; 560 };
537 561
538 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy, 562 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy,
539 const SkIRect& subset, 563 const SkIRect& subset,
540 uint32_t uniqueID, 564 uint32_t uniqueID,
541 GrTexture* tex, 565 GrTexture* tex,
566 const SkSurfaceProps* props,
542 SkAlphaType at) { 567 SkAlphaType at) {
543 SkASSERT(rect_fits(subset, tex->width(), tex->height())); 568 SkASSERT(rect_fits(subset, tex->width(), tex->height()));
544 return sk_make_sp<SkSpecialImage_Gpu>(proxy, subset, uniqueID, tex, at); 569 return sk_make_sp<SkSpecialImage_Gpu>(proxy, subset, uniqueID, tex, at, prop s);
545 } 570 }
546 571
547 #else 572 #else
548 573
549 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy, 574 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy,
550 const SkIRect& subset, 575 const SkIRect& subset,
551 uint32_t uniqueID, 576 uint32_t uniqueID,
552 GrTexture* tex, 577 GrTexture* tex,
578 const SkSurfaceProps* props,
553 SkAlphaType at) { 579 SkAlphaType at) {
554 return nullptr; 580 return nullptr;
555 } 581 }
556 582
557 #endif 583 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698