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

Unified Diff: src/core/SkColorFilter.cpp

Issue 19305004: Move implementation of SkFilterShader into its source file. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gyp/core.gypi ('k') | src/core/SkFilterShader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkColorFilter.cpp
diff --git a/src/core/SkColorFilter.cpp b/src/core/SkColorFilter.cpp
index 383397dbcae59854e923c04df42b69c78c9ef6b3..abf191e16f4d20b31cd548e0aa9336b1f110415e 100644
--- a/src/core/SkColorFilter.cpp
+++ b/src/core/SkColorFilter.cpp
@@ -6,7 +6,7 @@
*/
#include "SkColorFilter.h"
-#include "SkFilterShader.h"
+
#include "SkFlattenableBuffers.h"
#include "SkShader.h"
#include "SkUnPreMultiply.h"
@@ -44,91 +44,3 @@ SkColor SkColorFilter::filterColor(SkColor c) const {
GrEffectRef* SkColorFilter::asNewEffect(GrContext*) const {
return NULL;
}
-
-///////////////////////////////////////////////////////////////////////////////
-
-SkFilterShader::SkFilterShader(SkShader* shader, SkColorFilter* filter) {
- fShader = shader; shader->ref();
- fFilter = filter; filter->ref();
-}
-
-SkFilterShader::SkFilterShader(SkFlattenableReadBuffer& buffer) :
- INHERITED(buffer) {
- fShader = buffer.readFlattenableT<SkShader>();
- fFilter = buffer.readFlattenableT<SkColorFilter>();
-}
-
-SkFilterShader::~SkFilterShader() {
- fFilter->unref();
- fShader->unref();
-}
-
-void SkFilterShader::flatten(SkFlattenableWriteBuffer& buffer) const {
- this->INHERITED::flatten(buffer);
- buffer.writeFlattenable(fShader);
- buffer.writeFlattenable(fFilter);
-}
-
-uint32_t SkFilterShader::getFlags() {
- uint32_t shaderF = fShader->getFlags();
- uint32_t filterF = fFilter->getFlags();
-
- // if the filter doesn't support 16bit, clear the matching bit in the shader
- if (!(filterF & SkColorFilter::kHasFilter16_Flag)) {
- shaderF &= ~SkShader::kHasSpan16_Flag;
- }
- // if the filter might change alpha, clear the opaque flag in the shader
- if (!(filterF & SkColorFilter::kAlphaUnchanged_Flag)) {
- shaderF &= ~(SkShader::kOpaqueAlpha_Flag | SkShader::kHasSpan16_Flag);
- }
- return shaderF;
-}
-
-bool SkFilterShader::setContext(const SkBitmap& device,
- const SkPaint& paint,
- const SkMatrix& matrix) {
- // we need to keep the setContext/endContext calls balanced. If we return
- // false, our endContext() will not be called.
-
- if (!this->INHERITED::setContext(device, paint, matrix)) {
- return false;
- }
- if (!fShader->setContext(device, paint, matrix)) {
- this->INHERITED::endContext();
- return false;
- }
- return true;
-}
-
-void SkFilterShader::endContext() {
- fShader->endContext();
- this->INHERITED::endContext();
-}
-
-void SkFilterShader::shadeSpan(int x, int y, SkPMColor result[], int count) {
- fShader->shadeSpan(x, y, result, count);
- fFilter->filterSpan(result, count, result);
-}
-
-void SkFilterShader::shadeSpan16(int x, int y, uint16_t result[], int count) {
- SkASSERT(fShader->getFlags() & SkShader::kHasSpan16_Flag);
- SkASSERT(fFilter->getFlags() & SkColorFilter::kHasFilter16_Flag);
-
- fShader->shadeSpan16(x, y, result, count);
- fFilter->filterSpan16(result, count, result);
-}
-
-#ifdef SK_DEVELOPER
-void SkFilterShader::toString(SkString* str) const {
- str->append("SkFilterShader: (");
-
- str->append("Shader: ");
- fShader->toString(str);
- str->append(" Filter: ");
- // TODO: add "fFilter->toString(str);" once SkColorFilter::toString is added
-
- this->INHERITED::toString(str);
-
- str->append(")");
-}
-#endif
« no previous file with comments | « gyp/core.gypi ('k') | src/core/SkFilterShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698