| OLD | NEW |
| 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 | 9 |
| 10 #include "GrDrawTargetCaps.h" | 10 #include "GrDrawTargetCaps.h" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 namespace { | 116 namespace { |
| 117 | 117 |
| 118 // When the SkPixelRef genID changes, invalidate a corresponding GrResource desc
ribed by key. | 118 // When the SkPixelRef genID changes, invalidate a corresponding GrResource desc
ribed by key. |
| 119 class GrResourceInvalidator : public SkPixelRef::GenIDChangeListener { | 119 class GrResourceInvalidator : public SkPixelRef::GenIDChangeListener { |
| 120 public: | 120 public: |
| 121 explicit GrResourceInvalidator(GrResourceKey key) : fKey(key) {} | 121 explicit GrResourceInvalidator(GrResourceKey key) : fKey(key) {} |
| 122 private: | 122 private: |
| 123 GrResourceKey fKey; | 123 GrResourceKey fKey; |
| 124 | 124 |
| 125 virtual void onChange() SK_OVERRIDE { | 125 void onChange() SK_OVERRIDE { |
| 126 const GrResourceInvalidatedMessage message = { fKey }; | 126 const GrResourceInvalidatedMessage message = { fKey }; |
| 127 SkMessageBus<GrResourceInvalidatedMessage>::Post(message); | 127 SkMessageBus<GrResourceInvalidatedMessage>::Post(message); |
| 128 } | 128 } |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 } // namespace | 131 } // namespace |
| 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))); |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 if (shader->asFragmentProcessor(context, skPaint, viewM, NULL, &paintCol
or, &fp) && fp) { | 581 if (shader->asFragmentProcessor(context, skPaint, viewM, NULL, &paintCol
or, &fp) && fp) { |
| 582 grPaint->addColorProcessor(fp)->unref(); | 582 grPaint->addColorProcessor(fp)->unref(); |
| 583 constantColor = false; | 583 constantColor = false; |
| 584 } | 584 } |
| 585 } | 585 } |
| 586 | 586 |
| 587 // The grcolor is automatically set when calling asFragmentProcessor. | 587 // The grcolor is automatically set when calling asFragmentProcessor. |
| 588 // 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. |
| 589 SkPaint2GrPaintNoShader(context, skPaint, paintColor, constantColor, grPaint
); | 589 SkPaint2GrPaintNoShader(context, skPaint, paintColor, constantColor, grPaint
); |
| 590 } | 590 } |
| OLD | NEW |