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 "SkBitmapCache.h" | 8 #include "SkBitmapCache.h" |
9 #include "SkImage_Gpu.h" | 9 #include "SkImage_Gpu.h" |
10 #include "GrCaps.h" | 10 #include "GrCaps.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 extern void SkTextureImageApplyBudgetedDecision(SkImage* image) { | 35 extern void SkTextureImageApplyBudgetedDecision(SkImage* image) { |
36 if (as_IB(image)->getTexture()) { | 36 if (as_IB(image)->getTexture()) { |
37 ((SkImage_Gpu*)image)->applyBudgetDecision(); | 37 ((SkImage_Gpu*)image)->applyBudgetDecision(); |
38 } | 38 } |
39 } | 39 } |
40 | 40 |
41 static SkImageInfo make_info(int w, int h, bool isOpaque) { | 41 static SkImageInfo make_info(int w, int h, bool isOpaque) { |
42 return SkImageInfo::MakeN32(w, h, isOpaque ? kOpaque_SkAlphaType : kPremul_S
kAlphaType); | 42 return SkImageInfo::MakeN32(w, h, isOpaque ? kOpaque_SkAlphaType : kPremul_S
kAlphaType); |
43 } | 43 } |
44 | 44 |
45 bool SkImage_Gpu::getROPixels(SkBitmap* dst) const { | 45 bool SkImage_Gpu::getROPixels(SkBitmap* dst, SkScalar scaleHint) const { |
46 if (SkBitmapCache::Find(this->uniqueID(), dst)) { | 46 if (SkBitmapCache::Find(this->uniqueID(), dst)) { |
47 SkASSERT(dst->getGenerationID() == this->uniqueID()); | 47 SkASSERT(dst->getGenerationID() == this->uniqueID()); |
48 SkASSERT(dst->isImmutable()); | 48 SkASSERT(dst->isImmutable()); |
49 SkASSERT(dst->getPixels()); | 49 SkASSERT(dst->getPixels()); |
50 return true; | 50 return true; |
51 } | 51 } |
52 | 52 |
53 if (!dst->tryAllocPixels(make_info(this->width(), this->height(), this->isOp
aque()))) { | 53 if (!dst->tryAllocPixels(make_info(this->width(), this->height(), this->isOp
aque()))) { |
54 return false; | 54 return false; |
55 } | 55 } |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 if (!dst) { | 402 if (!dst) { |
403 return nullptr; | 403 return nullptr; |
404 } | 404 } |
405 | 405 |
406 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); | 406 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); |
407 const SkIPoint dstP = SkIPoint::Make(0, 0); | 407 const SkIPoint dstP = SkIPoint::Make(0, 0); |
408 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); | 408 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); |
409 return dst; | 409 return dst; |
410 } | 410 } |
411 | 411 |
OLD | NEW |