| OLD | NEW |
| 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" |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint)
const override { | 318 void onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint)
const override { |
| 319 SkRect dst = SkRect::MakeXYWH(x, y, | 319 SkRect dst = SkRect::MakeXYWH(x, y, |
| 320 this->subset().width(), this->subset().hei
ght()); | 320 this->subset().width(), this->subset().hei
ght()); |
| 321 | 321 |
| 322 canvas->drawBitmapRect(fBitmap, this->subset(), | 322 canvas->drawBitmapRect(fBitmap, this->subset(), |
| 323 dst, paint, SkCanvas::kStrict_SrcRectConstraint); | 323 dst, paint, SkCanvas::kStrict_SrcRectConstraint); |
| 324 } | 324 } |
| 325 | 325 |
| 326 bool onPeekPixels(SkPixmap* pixmap) const override { | 326 bool onPeekPixels(SkPixmap* pixmap) const override { |
| 327 const SkImageInfo info = fBitmap.info(); | 327 const SkImageInfo info = fBitmap.info(); |
| 328 if ((kUnknown_SkColorType == info.colorType()) || !fBitmap.getPixels())
{ | 328 |
| 329 if (kUnknown_SkColorType == info.colorType()) { |
| 329 return false; | 330 return false; |
| 330 } | 331 } |
| 331 | 332 |
| 333 if (!fBitmap.peekPixels(pixmap)) { |
| 334 fBitmap.lockPixels(); |
| 335 } |
| 336 |
| 332 return fBitmap.peekPixels(pixmap); | 337 return fBitmap.peekPixels(pixmap); |
| 333 } | 338 } |
| 334 | 339 |
| 335 bool getBitmapDeprecated(SkBitmap* result) const override { | 340 bool getBitmapDeprecated(SkBitmap* result) const override { |
| 336 *result = fBitmap; | 341 *result = fBitmap; |
| 337 return true; | 342 return true; |
| 338 } | 343 } |
| 339 | 344 |
| 340 bool testingOnlyOnGetROPixels(SkBitmap* result) const override { | 345 bool testingOnlyOnGetROPixels(SkBitmap* result) const override { |
| 341 *result = fBitmap; | 346 *result = fBitmap; |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 | 540 |
| 536 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy, | 541 sk_sp<SkSpecialImage> SkSpecialImage::MakeFromGpu(SkImageFilter::Proxy* proxy, |
| 537 const SkIRect& subset, | 542 const SkIRect& subset, |
| 538 uint32_t uniqueID, | 543 uint32_t uniqueID, |
| 539 GrTexture* tex, | 544 GrTexture* tex, |
| 540 SkAlphaType at) { | 545 SkAlphaType at) { |
| 541 return nullptr; | 546 return nullptr; |
| 542 } | 547 } |
| 543 | 548 |
| 544 #endif | 549 #endif |
| OLD | NEW |