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

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

Issue 1282363002: Use SkImageCacherator in SkImages (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: now with mutex safeness Created 5 years, 4 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
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 dst->getPixels(), dst->rowBytes())) { 72 dst->getPixels(), dst->rowBytes())) {
73 return false; 73 return false;
74 } 74 }
75 75
76 dst->pixelRef()->setImmutableWithID(this->uniqueID()); 76 dst->pixelRef()->setImmutableWithID(this->uniqueID());
77 SkBitmapCache::Add(this->uniqueID(), *dst); 77 SkBitmapCache::Add(this->uniqueID(), *dst);
78 fAddedRasterVersionToCache.store(true); 78 fAddedRasterVersionToCache.store(true);
79 return true; 79 return true;
80 } 80 }
81 81
82 GrTexture* SkImage_Gpu::asTextureRef(GrContext* ctx, SkImageUsageType usage) con st {
83 fTexture->ref();
84 return fTexture;
85 }
86
82 bool SkImage_Gpu::isOpaque() const { 87 bool SkImage_Gpu::isOpaque() const {
83 return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaque_Sk AlphaType; 88 return GrPixelConfigIsOpaque(fTexture->config()) || fAlphaType == kOpaque_Sk AlphaType;
84 } 89 }
85 90
86 static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes) { 91 static void apply_premul(const SkImageInfo& info, void* pixels, size_t rowBytes) {
87 switch (info.colorType()) { 92 switch (info.colorType()) {
88 case kRGBA_8888_SkColorType: 93 case kRGBA_8888_SkColorType:
89 case kBGRA_8888_SkColorType: 94 case kBGRA_8888_SkColorType:
90 break; 95 break;
91 default: 96 default:
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 if (!dst) { 277 if (!dst) {
273 return NULL; 278 return NULL;
274 } 279 }
275 280
276 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight); 281 const SkIRect srcR = SkIRect::MakeWH(desc.fWidth, desc.fHeight);
277 const SkIPoint dstP = SkIPoint::Make(0, 0); 282 const SkIPoint dstP = SkIPoint::Make(0, 0);
278 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp); 283 ctx->copySurface(dst, src, srcR, dstP, GrContext::kFlushWrites_PixelOp);
279 return dst; 284 return dst;
280 } 285 }
281 286
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698