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 "SkImage_Gpu.h" | 8 #include "SkImage_Gpu.h" |
9 #include "GrContext.h" | 9 #include "GrContext.h" |
10 #include "GrDrawContext.h" | 10 #include "GrDrawContext.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 if (!ctx) { | 29 if (!ctx) { |
30 // the texture may have been abandoned, so we have to check | 30 // the texture may have been abandoned, so we have to check |
31 return NULL; | 31 return NULL; |
32 } | 32 } |
33 // TODO: Change signature of onNewSurface to take a budgeted param. | 33 // TODO: Change signature of onNewSurface to take a budgeted param. |
34 const SkSurface::Budgeted budgeted = SkSurface::kNo_Budgeted; | 34 const SkSurface::Budgeted budgeted = SkSurface::kNo_Budgeted; |
35 return SkSurface::NewRenderTarget(ctx, budgeted, info, fSampleCountForNewSur
faces, &props); | 35 return SkSurface::NewRenderTarget(ctx, budgeted, info, fSampleCountForNewSur
faces, &props); |
36 } | 36 } |
37 | 37 |
38 extern void SkTextureImageApplyBudgetedDecision(SkImage* image) { | 38 extern void SkTextureImageApplyBudgetedDecision(SkImage* image) { |
39 if (image->getTexture()) { | 39 if (as_IB(image)->getTexture()) { |
40 ((SkImage_Gpu*)image)->applyBudgetDecision(); | 40 ((SkImage_Gpu*)image)->applyBudgetDecision(); |
41 } | 41 } |
42 } | 42 } |
43 | 43 |
44 SkShader* SkImage_Gpu::onNewShader(SkShader::TileMode tileX, SkShader::TileMode
tileY, | 44 SkShader* SkImage_Gpu::onNewShader(SkShader::TileMode tileX, SkShader::TileMode
tileY, |
45 const SkMatrix* localMatrix) const { | 45 const SkMatrix* localMatrix) const { |
46 SkBitmap bm; | 46 SkBitmap bm; |
47 GrWrapTextureInBitmap(fTexture, this->width(), this->height(), this->isOpaqu
e(), &bm); | 47 GrWrapTextureInBitmap(fTexture, this->width(), this->height(), this->isOpaqu
e(), &bm); |
48 return SkShader::CreateBitmapShader(bm, tileX, tileY, localMatrix); | 48 return SkShader::CreateBitmapShader(bm, tileX, tileY, localMatrix); |
49 } | 49 } |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 colorSpace))->unref(); | 227 colorSpace))->unref(); |
228 | 228 |
229 const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth), | 229 const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth), |
230 SkIntToScalar(dstDesc.fHeight)); | 230 SkIntToScalar(dstDesc.fHeight)); |
231 ctx->drawContext()->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), pain
t, SkMatrix::I(), | 231 ctx->drawContext()->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), pain
t, SkMatrix::I(), |
232 rect); | 232 rect); |
233 ctx->flushSurfaceWrites(dst); | 233 ctx->flushSurfaceWrites(dst); |
234 return SkNEW_ARGS(SkImage_Gpu, (dstDesc.fWidth, dstDesc.fHeight, kOpaque_SkA
lphaType, dst, 0, | 234 return SkNEW_ARGS(SkImage_Gpu, (dstDesc.fWidth, dstDesc.fHeight, kOpaque_SkA
lphaType, dst, 0, |
235 budgeted)); | 235 budgeted)); |
236 } | 236 } |
OLD | NEW |