9a6eb0e1e8
Doing it this way required modifying the arithmode GM to use saveLayer()/restore() rather than creating an offscreen SkBitmap, since otherwise the compositing is always done in raster mode. Fixing that in turn exposed that SkArithmeticMode did not work in Picture mode, since it wasn't flattenable. Made it so. Note: this will require rebaselining the arithmode GM (again). R=bsalomon@google.com, reed@google.com Originally committed: https://code.google.com/p/skia/source/detail?r=9324 Reverted: https://code.google.com/p/skia/source/detail?r=9325 Review URL: https://codereview.chromium.org/16064002 git-svn-id: http://skia.googlecode.com/svn/trunk@9330 2bbb7eff-a529-9590-31e7-b0007b416f81
35 lines
909 B
C++
35 lines
909 B
C++
/*
|
|
* Copyright 2011 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef SkArithmeticMode_DEFINED
|
|
#define SkArithmeticMode_DEFINED
|
|
|
|
#include "SkXfermode.h"
|
|
|
|
class SK_API SkArithmeticMode : public SkXfermode {
|
|
public:
|
|
/**
|
|
* result = clamp[k1 * src * dst + k2 * src + k3 * dst + k4]
|
|
*
|
|
* src and dst are treated as being [0.0 .. 1.0]. The polynomial is
|
|
* evaluated on their unpremultiplied components.
|
|
*
|
|
* k1=k2=k3=0, k4=1.0 results in returning opaque white
|
|
* k1=k3=k4=0, k2=1.0 results in returning the src
|
|
* k1=k2=k4=0, k3=1.0 results in returning the dst
|
|
*/
|
|
static SkXfermode* Create(SkScalar k1, SkScalar k2,
|
|
SkScalar k3, SkScalar k4);
|
|
|
|
SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP();
|
|
|
|
private:
|
|
typedef SkXfermode INHERITED;
|
|
};
|
|
|
|
#endif
|