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 "GrContext.h" | 10 #include "GrContext.h" |
11 #include "GrDrawContext.h" | 11 #include "GrDrawContext.h" |
12 #include "effects/GrYUVtoRGBEffect.h" | 12 #include "effects/GrYUVtoRGBEffect.h" |
13 #include "SkCanvas.h" | 13 #include "SkCanvas.h" |
14 #include "SkGpuDevice.h" | 14 #include "SkGpuDevice.h" |
15 #include "SkPixelRef.h" | 15 #include "SkPixelRef.h" |
16 | 16 |
17 SkImage_Gpu::SkImage_Gpu(int w, int h, uint32_t uniqueID, SkAlphaType at, GrText
ure* tex, | 17 SkImage_Gpu::SkImage_Gpu(int w, int h, uint32_t uniqueID, SkAlphaType at, GrText
ure* tex, |
18 int sampleCountForNewSurfaces, SkSurface::Budgeted budg
eted) | 18 int sampleCountForNewSurfaces, SkSurface::Budgeted budg
eted) |
19 : INHERITED(w, h, uniqueID, NULL) | 19 : INHERITED(w, h, uniqueID, NULL) |
20 , fTexture(SkRef(tex)) | 20 , fTexture(SkRef(tex)) |
21 , fSampleCountForNewSurfaces(sampleCountForNewSurfaces) | 21 , fSampleCountForNewSurfaces(sampleCountForNewSurfaces) |
22 , fAlphaType(at) | 22 , fAlphaType(at) |
23 , fBudgeted(budgeted) | 23 , fBudgeted(budgeted) |
| 24 , fAddedRasterVersionToCache(false) |
24 {} | 25 {} |
25 | 26 |
26 SkImage_Gpu::~SkImage_Gpu() { | 27 SkImage_Gpu::~SkImage_Gpu() { |
27 if (fAddedRasterVersionToCache.load()) { | 28 if (fAddedRasterVersionToCache.load()) { |
28 SkNotifyBitmapGenIDIsStale(this->uniqueID()); | 29 SkNotifyBitmapGenIDIsStale(this->uniqueID()); |
29 } | 30 } |
30 } | 31 } |
31 | 32 |
32 SkSurface* SkImage_Gpu::onNewSurface(const SkImageInfo& info, const SkSurfacePro
ps& props) const { | 33 SkSurface* SkImage_Gpu::onNewSurface(const SkImageInfo& info, const SkSurfacePro
ps& props) const { |
33 GrTexture* tex = this->getTexture(); | 34 GrTexture* tex = this->getTexture(); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 if (!dst) { | 272 if (!dst) { |
272 return NULL; | 273 return NULL; |
273 } | 274 } |
274 | 275 |
275 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); | 276 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); |
276 const SkIPoint dstP = SkIPoint::Make(0, 0); | 277 const SkIPoint dstP = SkIPoint::Make(0, 0); |
277 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); | 278 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); |
278 return dst; | 279 return dst; |
279 } | 280 } |
280 | 281 |
OLD | NEW |