aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/SkBitmapSource.cpp
blob: 3092b93c9db969f93a0aac49af0219810ad69ad6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * Copyright 2012 The Android Open Source Project
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#include "SkBitmapSource.h"

SkBitmapSource::SkBitmapSource(const SkBitmap& bitmap) : fBitmap(bitmap) {
}

SkBitmapSource::SkBitmapSource(SkFlattenableReadBuffer& buffer)
  : INHERITED(buffer) {
    fBitmap.unflatten(buffer);
}

void SkBitmapSource::flatten(SkFlattenableWriteBuffer& buffer) const {
    this->INHERITED::flatten(buffer);
    fBitmap.flatten(buffer);
}

bool SkBitmapSource::onFilterImage(Proxy*, const SkBitmap&, const SkMatrix&,
                                   SkBitmap* result, SkIPoint* offset) {
    *result = fBitmap;
    return true;
}

SK_DEFINE_FLATTENABLE_REGISTRAR(SkBitmapSource)