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

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

Issue 1355863002: Revert of add ImageShader, sharing code with its Bitmap cousin (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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/SkImage_Raster.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 "SkBitmapCache.h" 8 #include "SkBitmapCache.h"
9 #include "SkImage_Gpu.h" 9 #include "SkImage_Gpu.h"
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 const SkSurface::Budgeted budgeted = SkSurface::kNo_Budgeted; 42 const SkSurface::Budgeted budgeted = SkSurface::kNo_Budgeted;
43 return SkSurface::NewRenderTarget(ctx, budgeted, info, fSampleCountForNewSur faces, &props); 43 return SkSurface::NewRenderTarget(ctx, budgeted, info, fSampleCountForNewSur faces, &props);
44 } 44 }
45 45
46 extern void SkTextureImageApplyBudgetedDecision(SkImage* image) { 46 extern void SkTextureImageApplyBudgetedDecision(SkImage* image) {
47 if (as_IB(image)->getTexture()) { 47 if (as_IB(image)->getTexture()) {
48 ((SkImage_Gpu*)image)->applyBudgetDecision(); 48 ((SkImage_Gpu*)image)->applyBudgetDecision();
49 } 49 }
50 } 50 }
51 51
52 SkShader* SkImage_Gpu::onNewShader(SkShader::TileMode tileX, SkShader::TileMode tileY,
53 const SkMatrix* localMatrix) const {
54 SkBitmap bm;
55 GrWrapTextureInBitmap(fTexture, this->width(), this->height(), this->isOpaqu e(), &bm);
56 return SkShader::CreateBitmapShader(bm, tileX, tileY, localMatrix);
57 }
58
52 bool SkImage_Gpu::getROPixels(SkBitmap* dst) const { 59 bool SkImage_Gpu::getROPixels(SkBitmap* dst) const {
53 if (SkBitmapCache::Find(this->uniqueID(), dst)) { 60 if (SkBitmapCache::Find(this->uniqueID(), dst)) {
54 SkASSERT(dst->getGenerationID() == this->uniqueID()); 61 SkASSERT(dst->getGenerationID() == this->uniqueID());
55 SkASSERT(dst->isImmutable()); 62 SkASSERT(dst->isImmutable());
56 SkASSERT(dst->getPixels()); 63 SkASSERT(dst->getPixels());
57 return true; 64 return true;
58 } 65 }
59 66
60 SkAlphaType at = this->isOpaque() ? kOpaque_SkAlphaType : kPremul_SkAlphaTyp e; 67 SkAlphaType at = this->isOpaque() ? kOpaque_SkAlphaType : kPremul_SkAlphaTyp e;
61 if (!dst->tryAllocPixels(SkImageInfo::MakeN32(this->width(), this->height(), at))) { 68 if (!dst->tryAllocPixels(SkImageInfo::MakeN32(this->width(), this->height(), at))) {
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 if (!dst) { 280 if (!dst) {
274 return nullptr; 281 return nullptr;
275 } 282 }
276 283
277 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); 284 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight);
278 const SkIPoint dstP = SkIPoint::Make(0, 0); 285 const SkIPoint dstP = SkIPoint::Make(0, 0);
279 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); 286 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp);
280 return dst; 287 return dst;
281 } 288 }
282 289
OLDNEW
« no previous file with comments | « src/image/SkImage_Gpu.h ('k') | src/image/SkImage_Raster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698