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

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

Issue 559093003: Revert of Added test for non cached ETC1 (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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 | « gm/etc1bitmap.cpp ('k') | no next file » | 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 2010 Google Inc. 2 * Copyright 2010 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 "SkGr.h" 8 #include "SkGr.h"
9 #include "SkColorFilter.h" 9 #include "SkColorFilter.h"
10 #include "SkConfig8888.h" 10 #include "SkConfig8888.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 132
133 static void add_genID_listener(GrResourceKey key, SkPixelRef* pixelRef) { 133 static void add_genID_listener(GrResourceKey key, SkPixelRef* pixelRef) {
134 SkASSERT(pixelRef); 134 SkASSERT(pixelRef);
135 pixelRef->addGenIDChangeListener(SkNEW_ARGS(GrResourceInvalidator, (key))); 135 pixelRef->addGenIDChangeListener(SkNEW_ARGS(GrResourceInvalidator, (key)));
136 } 136 }
137 137
138 static GrTexture* sk_gr_allocate_texture(GrContext* ctx, 138 static GrTexture* sk_gr_allocate_texture(GrContext* ctx,
139 bool cache, 139 bool cache,
140 const GrTextureParams* params, 140 const GrTextureParams* params,
141 const SkBitmap& bm, 141 const SkBitmap& bm,
142 const GrTextureDesc& desc, 142 GrTextureDesc desc,
143 const void* pixels, 143 const void* pixels,
144 size_t rowBytes) { 144 size_t rowBytes) {
145 GrTexture* result; 145 GrTexture* result;
146 if (cache) { 146 if (cache) {
147 // This texture is likely to be used again so leave it in the cache 147 // This texture is likely to be used again so leave it in the cache
148 GrCacheID cacheID; 148 GrCacheID cacheID;
149 generate_bitmap_cache_id(bm, &cacheID); 149 generate_bitmap_cache_id(bm, &cacheID);
150 150
151 GrResourceKey key; 151 GrResourceKey key;
152 result = ctx->createTexture(params, desc, cacheID, pixels, rowBytes, &ke y); 152 result = ctx->createTexture(params, desc, cacheID, pixels, rowBytes, &ke y);
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 origBitmap.copyTo(&tmpBitmap, kN32_SkColorType); 315 origBitmap.copyTo(&tmpBitmap, kN32_SkColorType);
316 // now bitmap points to our temp, which has been promoted to 32bits 316 // now bitmap points to our temp, which has been promoted to 32bits
317 bitmap = &tmpBitmap; 317 bitmap = &tmpBitmap;
318 desc.fConfig = SkImageInfo2GrPixelConfig(bitmap->info()); 318 desc.fConfig = SkImageInfo2GrPixelConfig(bitmap->info());
319 } 319 }
320 } 320 }
321 321
322 // Is this an ETC1 encoded texture? 322 // Is this an ETC1 encoded texture?
323 #ifndef SK_IGNORE_ETC1_SUPPORT 323 #ifndef SK_IGNORE_ETC1_SUPPORT
324 else if ( 324 else if (
325 // We do not support scratch ETC1 textures, hence they should all be at least
326 // trying to go to the cache.
327 cache
325 // Make sure that the underlying device supports ETC1 textures before we go ahead 328 // Make sure that the underlying device supports ETC1 textures before we go ahead
326 // and check the data. 329 // and check the data.
327 ctx->getGpu()->caps()->isConfigTexturable(kETC1_GrPixelConfig) 330 && ctx->getGpu()->caps()->isConfigTexturable(kETC1_GrPixelConfig)
328 // If the bitmap had compressed data and was then uncompressed, it'll st ill return 331 // If the bitmap had compressed data and was then uncompressed, it'll st ill return
329 // compressed data on 'refEncodedData' and upload it. Probably not good, since if 332 // compressed data on 'refEncodedData' and upload it. Probably not good, since if
330 // the bitmap has available pixels, then they might not be what the deco mpressed 333 // the bitmap has available pixels, then they might not be what the deco mpressed
331 // data is. 334 // data is.
332 && !(bitmap->readyToDraw())) { 335 && !(bitmap->readyToDraw())) {
333 GrTexture *texture = load_etc1_texture(ctx, cache, params, *bitmap, desc ); 336 GrTexture *texture = load_etc1_texture(ctx, cache, params, *bitmap, desc );
334 if (texture) { 337 if (texture) {
335 return texture; 338 return texture;
336 } 339 }
337 } 340 }
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 if (shader->asNewEffect(context, skPaint, NULL, &paintColor, &effect) && effect) { 573 if (shader->asNewEffect(context, skPaint, NULL, &paintColor, &effect) && effect) {
571 grPaint->addColorEffect(effect)->unref(); 574 grPaint->addColorEffect(effect)->unref();
572 constantColor = false; 575 constantColor = false;
573 } 576 }
574 } 577 }
575 578
576 // The grcolor is automatically set when calling asneweffect. 579 // The grcolor is automatically set when calling asneweffect.
577 // If the shader can be seen as an effect it returns true and adds its effec t to the grpaint. 580 // If the shader can be seen as an effect it returns true and adds its effec t to the grpaint.
578 SkPaint2GrPaintNoShader(context, skPaint, paintColor, constantColor, grPaint ); 581 SkPaint2GrPaintNoShader(context, skPaint, paintColor, constantColor, grPaint );
579 } 582 }
OLDNEW
« no previous file with comments | « gm/etc1bitmap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698