blob: 3092b93c9db969f93a0aac49af0219810ad69ad6 [file] [log] [blame]
senorblanco@chromium.orgf1369ce2012-08-20 14:53:21 +00001/*
2 * Copyright 2012 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 "SkBitmapSource.h"
9
10SkBitmapSource::SkBitmapSource(const SkBitmap& bitmap) : fBitmap(bitmap) {
11}
12
13SkBitmapSource::SkBitmapSource(SkFlattenableReadBuffer& buffer)
14 : INHERITED(buffer) {
15 fBitmap.unflatten(buffer);
16}
17
18void SkBitmapSource::flatten(SkFlattenableWriteBuffer& buffer) const {
19 this->INHERITED::flatten(buffer);
20 fBitmap.flatten(buffer);
21}
22
23bool SkBitmapSource::onFilterImage(Proxy*, const SkBitmap&, const SkMatrix&,
24 SkBitmap* result, SkIPoint* offset) {
25 *result = fBitmap;
26 return true;
27}
28
29SK_DEFINE_FLATTENABLE_REGISTRAR(SkBitmapSource)