1 /* 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 10 SkBitmapSource::SkBitmapSource(const SkBitmap& bitmap) 11 : INHERITED(0), 12 fBitmap(bitmap) { 13 } 14 15 SkBitmapSource::SkBitmapSource(SkFlattenableReadBuffer& buffer) 16 : INHERITED(buffer) { 17 fBitmap.unflatten(buffer); 18 } 19 20 void SkBitmapSource::flatten(SkFlattenableWriteBuffer& buffer) const { 21 this->INHERITED::flatten(buffer); 22 fBitmap.flatten(buffer); 23 } 24 25 bool SkBitmapSource::onFilterImage(Proxy*, const SkBitmap&, const SkMatrix&, 26 SkBitmap* result, SkIPoint* offset) { 27 *result = fBitmap; 28 return true; 29 } 30