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 "SkFlattenableBuffers.h"
     11 #include "SkShader.h"
     12 #include "SkUnPreMultiply.h"
     13 #include "SkString.h"
     14 
     15 SK_DEFINE_INST_COUNT(SkColorFilter)
     16 
     17 bool SkColorFilter::asColorMode(SkColor* color, SkXfermode::Mode* mode) const {
     18     return false;
     19 }
     20 
     21 bool SkColorFilter::asColorMatrix(SkScalar matrix[20]) const {
     22     return false;
     23 }
     24 
     25 bool SkColorFilter::asComponentTable(SkBitmap*) const {
     26     return false;
     27 }
     28 
     29 void SkColorFilter::filterSpan16(const uint16_t s[], int count, uint16_t d[]) const {
     30     SkASSERT(this->getFlags() & SkColorFilter::kHasFilter16_Flag);
     31     SkDEBUGFAIL("missing implementation of SkColorFilter::filterSpan16");
     32 
     33     if (d != s) {
     34         memcpy(d, s, count * sizeof(uint16_t));
     35     }
     36 }
     37 
     38 SkColor SkColorFilter::filterColor(SkColor c) const {
     39     SkPMColor dst, src = SkPreMultiplyColor(c);
     40     this->filterSpan(&src, 1, &dst);
     41     return SkUnPreMultiply::PMColorToColor(dst);
     42 }
     43 
     44 GrEffectRef* SkColorFilter::asNewEffect(GrContext*) const {
     45     return NULL;
     46 }
     47