SkLayerRasterizer.h revision fbfcd5602128ec010c82cb733c9cdc0a3254f9f3
1ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com 28a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com/* 3ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Copyright 2006 The Android Open Source Project 48a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com * 5ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * Use of this source code is governed by a BSD-style license that can be 6ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com * found in the LICENSE file. 78a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com */ 88a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 9ec3ed6a5ebf6f2c406d7bcf94b6bc34fcaeb976eepoger@google.com 108a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#ifndef SkLayerRasterizer_DEFINED 118a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#define SkLayerRasterizer_DEFINED 128a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 138a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkRasterizer.h" 148a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkDeque.h" 158a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#include "SkScalar.h" 168a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 178a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SkPaint; 188a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 198a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comclass SkLayerRasterizer : public SkRasterizer { 208a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.compublic: 218a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkLayerRasterizer(); 228a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com virtual ~SkLayerRasterizer(); 23fbfcd5602128ec010c82cb733c9cdc0a3254f9f3rmistry@google.com 246b919c353727f72342a20a7aa4ded9c022f5d816mike@reedtribe.org void addLayer(const SkPaint& paint) { 258a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com this->addLayer(paint, 0, 0); 268a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com } 278a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 28fbfcd5602128ec010c82cb733c9cdc0a3254f9f3rmistry@google.com /** Add a new layer (above any previous layers) to the rasterizer. 29fbfcd5602128ec010c82cb733c9cdc0a3254f9f3rmistry@google.com The layer will extract those fields that affect the mask from 30fbfcd5602128ec010c82cb733c9cdc0a3254f9f3rmistry@google.com the specified paint, but will not retain a reference to the paint 31fbfcd5602128ec010c82cb733c9cdc0a3254f9f3rmistry@google.com object itself, so it may be reused without danger of side-effects. 32fbfcd5602128ec010c82cb733c9cdc0a3254f9f3rmistry@google.com */ 338a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com void addLayer(const SkPaint& paint, SkScalar dx, SkScalar dy); 348a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 35ba28d03e94dc221d6a803bf2a84a420b9159255cdjsollen@google.com SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkLayerRasterizer) 3643e9f20f4b5eecb2335e26461b5c4c84f2e3bcd2reed@google.com 378a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprotected: 388a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkLayerRasterizer(SkFlattenableReadBuffer&); 3954924243c1b65b3ee6d8fa064b50a9b1bb2a19a5djsollen@google.com virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; 408a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 418a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com // override from SkRasterizer 428a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com virtual bool onRasterize(const SkPath& path, const SkMatrix& matrix, 438a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com const SkIRect* clipBounds, 448a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkMask* mask, SkMask::CreateMode mode); 458a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 468a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.comprivate: 478a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com SkDeque fLayers; 488a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 498a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com typedef SkRasterizer INHERITED; 508a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com}; 518a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com 528a1c16ff38322f0210116fa7293eb8817c7e477ereed@android.com#endif 53