blob: 536c8926d47d1e92a27d121be49cfef77a0a3729 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001/*
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
reed@android.com8a1c16f2008-12-17 15:59:43 +00008#ifndef SkSpriteBlitter_DEFINED
9#define SkSpriteBlitter_DEFINED
10
commit-bot@chromium.orga5572e52014-03-07 03:24:41 +000011#include "SkBlitter.h"
reedcb674142015-06-05 06:58:22 -070012#include "SkPixmap.h"
commit-bot@chromium.orga5572e52014-03-07 03:24:41 +000013#include "SkShader.h"
14#include "SkSmallAllocator.h"
reed@android.com8a1c16f2008-12-17 15:59:43 +000015
16class SkPaint;
17
18class SkSpriteBlitter : public SkBlitter {
19public:
reedc240e712015-05-23 12:26:41 -070020 SkSpriteBlitter(const SkPixmap& source);
reed@android.com8a1c16f2008-12-17 15:59:43 +000021
reedcb674142015-06-05 06:58:22 -070022 virtual void setup(const SkPixmap& dst, int left, int top, const SkPaint&);
reed@android.com8a1c16f2008-12-17 15:59:43 +000023
reed@android.com8a1c16f2008-12-17 15:59:43 +000024#ifdef SK_DEBUG
reedc240e712015-05-23 12:26:41 -070025 void blitH(int x, int y, int width) override;
26 void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]) override;
27 void blitV(int x, int y, int height, SkAlpha alpha) override;
28 void blitMask(const SkMask&, const SkIRect& clip) override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000029#endif
30
reedc240e712015-05-23 12:26:41 -070031 static SkSpriteBlitter* ChooseD16(const SkPixmap& source, const SkPaint&, SkTBlitterAllocator*);
32 static SkSpriteBlitter* ChooseD32(const SkPixmap& source, const SkPaint&, SkTBlitterAllocator*);
reed@android.com8a1c16f2008-12-17 15:59:43 +000033
34protected:
reedcb674142015-06-05 06:58:22 -070035 SkPixmap fDst;
reedc240e712015-05-23 12:26:41 -070036 const SkPixmap fSource;
reed@android.com8a1c16f2008-12-17 15:59:43 +000037 int fLeft, fTop;
38 const SkPaint* fPaint;
39};
40
41#endif