Home | History | Annotate | Download | only in core
      1 /*
      2  * Copyright 2006 The Android Open Source Project
      3  *
      4  * Use of this source code is governed by a BSD-style license that can be
      5  * found in the LICENSE file.
      6  */
      7 
      8 #include "SkColorFilter.h"
      9 
     10 #include "SkReadBuffer.h"
     11 #include "SkWriteBuffer.h"
     12 #include "SkShader.h"
     13 #include "SkUnPreMultiply.h"
     14 #include "SkString.h"
     15 
     16 bool SkColorFilter::asColorMode(SkColor* color, SkXfermode::Mode* mode) const {
     17     return false;
     18 }
     19 
     20 bool SkColorFilter::asColorMatrix(SkScalar matrix[20]) const {
     21     return false;
     22 }
     23 
     24 bool SkColorFilter::asComponentTable(SkBitmap*) const {
     25     return false;
     26 }
     27 
     28 void SkColorFilter::filterSpan16(const uint16_t s[], int count, uint16_t d[]) const {
     29     SkASSERT(this->getFlags() & SkColorFilter::kHasFilter16_Flag);
     30     SkDEBUGFAIL("missing implementation of SkColorFilter::filterSpan16");
     31 
     32     if (d != s) {
     33         memcpy(d, s, count * sizeof(uint16_t));
     34     }
     35 }
     36 
     37 SkColor SkColorFilter::filterColor(SkColor c) const {
     38     SkPMColor dst, src = SkPreMultiplyColor(c);
     39     this->filterSpan(&src, 1, &dst);
     40     return SkUnPreMultiply::PMColorToColor(dst);
     41 }
     42 
     43 GrFragmentProcessor* SkColorFilter::asFragmentProcessor(GrContext*) const {
     44     return NULL;
     45 }
     46