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

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

Issue 580863004: Adding 3D lut color filter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: As color filter instead of image filter 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
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 memcpy(key.fData8 + 14, &height, 2); 100 memcpy(key.fData8 + 14, &height, 2);
101 static const size_t kKeyDataSize = 16; 101 static const size_t kKeyDataSize = 16;
102 memset(key.fData8 + kKeyDataSize, 0, sizeof(key) - kKeyDataSize); 102 memset(key.fData8 + kKeyDataSize, 0, sizeof(key) - kKeyDataSize);
103 GR_STATIC_ASSERT(sizeof(key) >= kKeyDataSize); 103 GR_STATIC_ASSERT(sizeof(key) >= kKeyDataSize);
104 static const GrCacheID::Domain gBitmapTextureDomain = GrCacheID::GenerateDom ain(); 104 static const GrCacheID::Domain gBitmapTextureDomain = GrCacheID::GenerateDom ain();
105 id->reset(gBitmapTextureDomain, key); 105 id->reset(gBitmapTextureDomain, key);
106 } 106 }
107 107
108 static void generate_bitmap_texture_desc(const SkBitmap& bitmap, GrTextureDesc* desc) { 108 static void generate_bitmap_texture_desc(const SkBitmap& bitmap, GrTextureDesc* desc) {
109 desc->fFlags = kNone_GrTextureFlags; 109 desc->fFlags = kNone_GrTextureFlags;
110 desc->fWidth = bitmap.width(); 110 if (bitmap.is3DLut()) {
111 desc->fHeight = bitmap.height(); 111 desc->fWidth = desc->fHeight = desc->fDepth = bitmap.width();
112 } else {
113 desc->fWidth = bitmap.width();
114 desc->fHeight = bitmap.height();
115 desc->fDepth = 0;
116 }
112 desc->fConfig = SkImageInfo2GrPixelConfig(bitmap.info()); 117 desc->fConfig = SkImageInfo2GrPixelConfig(bitmap.info());
113 desc->fSampleCnt = 0; 118 desc->fSampleCnt = 0;
114 } 119 }
115 120
116 namespace { 121 namespace {
117 122
118 // When the SkPixelRef genID changes, invalidate a corresponding GrResource desc ribed by key. 123 // When the SkPixelRef genID changes, invalidate a corresponding GrResource desc ribed by key.
119 class GrResourceInvalidator : public SkPixelRef::GenIDChangeListener { 124 class GrResourceInvalidator : public SkPixelRef::GenIDChangeListener {
120 public: 125 public:
121 explicit GrResourceInvalidator(GrResourceKey key) : fKey(key) {} 126 explicit GrResourceInvalidator(GrResourceKey key) : fKey(key) {}
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 if (shader->asNewEffect(context, skPaint, NULL, &paintColor, &effect) && effect) { 581 if (shader->asNewEffect(context, skPaint, NULL, &paintColor, &effect) && effect) {
577 grPaint->addColorEffect(effect)->unref(); 582 grPaint->addColorEffect(effect)->unref();
578 constantColor = false; 583 constantColor = false;
579 } 584 }
580 } 585 }
581 586
582 // The grcolor is automatically set when calling asneweffect. 587 // The grcolor is automatically set when calling asneweffect.
583 // If the shader can be seen as an effect it returns true and adds its effec t to the grpaint. 588 // If the shader can be seen as an effect it returns true and adds its effec t to the grpaint.
584 SkPaint2GrPaintNoShader(context, skPaint, paintColor, constantColor, grPaint ); 589 SkPaint2GrPaintNoShader(context, skPaint, paintColor, constantColor, grPaint );
585 } 590 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698