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

Side by Side Diff: src/image/SkImage_Gpu.cpp

Issue 1166993002: Towards removing getTexture() from SkImage (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 6 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
« no previous file with comments | « src/image/SkImage_Gpu.h ('k') | src/image/SkSurface_Gpu.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/image/SkImage_Gpu.h ('k') | src/image/SkSurface_Gpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698