blob: 5cc483f6826f13f152087615478f9be8704aae6e [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
reed@android.com8a1c16f2008-12-17 15:59:43 +000011#include "SkBitmap.h"
commit-bot@chromium.orga5572e52014-03-07 03:24:41 +000012#include "SkBitmapProcShader.h"
13#include "SkBlitter.h"
14#include "SkShader.h"
15#include "SkSmallAllocator.h"
reed@android.com8a1c16f2008-12-17 15:59:43 +000016
17class SkPaint;
18
19class SkSpriteBlitter : public SkBlitter {
20public:
reedc240e712015-05-23 12:26:41 -070021 SkSpriteBlitter(const SkPixmap& source);
reed@android.com8a1c16f2008-12-17 15:59:43 +000022
reedc240e712015-05-23 12:26:41 -070023 virtual void setup(const SkBitmap& device, int left, int top, const SkPaint&);
reed@android.com8a1c16f2008-12-17 15:59:43 +000024
reed@android.com8a1c16f2008-12-17 15:59:43 +000025#ifdef SK_DEBUG
reedc240e712015-05-23 12:26:41 -070026 void blitH(int x, int y, int width) override;
27 void blitAntiH(int x, int y, const SkAlpha antialias[], const int16_t runs[]) override;
28 void blitV(int x, int y, int height, SkAlpha alpha) override;
29 void blitMask(const SkMask&, const SkIRect& clip) override;
reed@android.com8a1c16f2008-12-17 15:59:43 +000030#endif
31
reedc240e712015-05-23 12:26:41 -070032 static SkSpriteBlitter* ChooseD16(const SkPixmap& source, const SkPaint&, SkTBlitterAllocator*);
33 static SkSpriteBlitter* ChooseD32(const SkPixmap& source, const SkPaint&, SkTBlitterAllocator*);
reed@android.com8a1c16f2008-12-17 15:59:43 +000034
35protected:
36 const SkBitmap* fDevice;
reedc240e712015-05-23 12:26:41 -070037 const SkPixmap fSource;
reed@android.com8a1c16f2008-12-17 15:59:43 +000038 int fLeft, fTop;
39 const SkPaint* fPaint;
40};
41
42#endif