blob: 854df9df226bf2dbbe1ba92043f59a420632719c [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
senorblanco@chromium.org9f25de72012-10-10 20:36:13 +000010SkBitmapSource::SkBitmapSource(const SkBitmap& bitmap)
11 : INHERITED(0),
12 fBitmap(bitmap) {
senorblanco@chromium.orgf1369ce2012-08-20 14:53:21 +000013}
14
15SkBitmapSource::SkBitmapSource(SkFlattenableReadBuffer& buffer)
16 : INHERITED(buffer) {
17 fBitmap.unflatten(buffer);
18}
19
20void SkBitmapSource::flatten(SkFlattenableWriteBuffer& buffer) const {
21 this->INHERITED::flatten(buffer);
22 fBitmap.flatten(buffer);
23}
24
25bool SkBitmapSource::onFilterImage(Proxy*, const SkBitmap&, const SkMatrix&,
26 SkBitmap* result, SkIPoint* offset) {
27 *result = fBitmap;
28 return true;
29}