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

Side by Side Diff: src/gpu/GrImageIDTextureAdjuster.cpp

Issue 1510903002: Stop wrapping images backed by generators as bitmaps in SkGpuDevice (except when tiling) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: comment Created 5 years 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/gpu/GrImageIDTextureAdjuster.h ('k') | src/gpu/SkGpuDevice.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 2015 Google Inc. 2 * Copyright 2015 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 "GrImageIDTextureAdjuster.h" 8 #include "GrImageIDTextureAdjuster.h"
9 9
10 #include "GrContext.h" 10 #include "GrContext.h"
11 #include "GrGpuResourcePriv.h" 11 #include "GrGpuResourcePriv.h"
12 #include "SkBitmap.h" 12 #include "SkBitmap.h"
13 #include "SkGrPriv.h" 13 #include "SkGrPriv.h"
14 #include "SkImage_Base.h" 14 #include "SkImage_Base.h"
15 #include "SkImageCacherator.h"
15 #include "SkPixelRef.h" 16 #include "SkPixelRef.h"
16 17
17 GrBitmapTextureAdjuster::GrBitmapTextureAdjuster(const SkBitmap* bmp) 18 GrBitmapTextureAdjuster::GrBitmapTextureAdjuster(const SkBitmap* bmp)
18 : INHERITED(bmp->getTexture(), SkIRect::MakeWH(bmp->width(), bmp->height())) 19 : INHERITED(bmp->getTexture(), SkIRect::MakeWH(bmp->width(), bmp->height()))
19 , fBmp(bmp) {} 20 , fBmp(bmp) {}
20 21
21 void GrBitmapTextureAdjuster::makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) { 22 void GrBitmapTextureAdjuster::makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) {
22 if (fBmp->isVolatile()) { 23 if (fBmp->isVolatile()) {
23 return; 24 return;
24 } 25 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 90
90 void GrBitmapTextureMaker::makeCopyKey(const CopyParams& copyParams, GrUniqueKey * copyKey) { 91 void GrBitmapTextureMaker::makeCopyKey(const CopyParams& copyParams, GrUniqueKey * copyKey) {
91 if (fOriginalKey.isValid()) { 92 if (fOriginalKey.isValid()) {
92 MakeCopyKeyFromOrigKey(fOriginalKey, copyParams, copyKey); 93 MakeCopyKeyFromOrigKey(fOriginalKey, copyParams, copyKey);
93 } 94 }
94 } 95 }
95 96
96 void GrBitmapTextureMaker::didCacheCopy(const GrUniqueKey& copyKey) { 97 void GrBitmapTextureMaker::didCacheCopy(const GrUniqueKey& copyKey) {
97 GrInstallBitmapUniqueKeyInvalidator(copyKey, fBitmap.pixelRef()); 98 GrInstallBitmapUniqueKeyInvalidator(copyKey, fBitmap.pixelRef());
98 } 99 }
100
101 //////////////////////////////////////////////////////////////////////////////
102
103 GrImageTextureMaker::GrImageTextureMaker(GrContext* context, SkImageCacherator* cacher,
104 const SkImage* client, SkImage::Caching Hint chint)
105 : INHERITED(context, cacher->info().width(), cacher->info().height())
106 , fCacher(cacher)
107 , fClient(client)
108 , fCachingHint(chint) {
109 if (client) {
110 GrMakeKeyFromImageID(&fOriginalKey, client->uniqueID(),
111 SkIRect::MakeWH(this->width(), this->height()));
112 }
113 }
114
115 GrTexture* GrImageTextureMaker::refOriginalTexture() {
116 return fCacher->lockTexture(this->context(), fOriginalKey, fClient, fCaching Hint);
117 }
118
119 void GrImageTextureMaker::makeCopyKey(const CopyParams& stretch, GrUniqueKey* pa ramsCopyKey) {
120 if (fOriginalKey.isValid() && SkImage::kAllow_CachingHint == fCachingHint) {
121 MakeCopyKeyFromOrigKey(fOriginalKey, stretch, paramsCopyKey);
122 }
123 }
124
125 void GrImageTextureMaker::didCacheCopy(const GrUniqueKey& copyKey) {
126 if (fClient) {
127 as_IB(fClient)->notifyAddedToCache();
128 }
129 }
OLDNEW
« no previous file with comments | « src/gpu/GrImageIDTextureAdjuster.h ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698