• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2015 Google Inc.
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 "SkBitmapSourceDeserializer.h"
9 
10 #include "SkBitmap.h"
11 #include "SkFilterQuality.h"
12 #include "SkImage.h"
13 #include "SkImageSource.h"
14 #include "SkReadBuffer.h"
15 
CreateProc(SkReadBuffer & buffer)16 sk_sp<SkFlattenable> SkBitmapSourceDeserializer::CreateProc(SkReadBuffer& buffer) {
17     SkFilterQuality filterQuality = (SkFilterQuality)buffer.readInt();
18     SkRect src, dst;
19     buffer.readRect(&src);
20     buffer.readRect(&dst);
21     sk_sp<SkImage> image = buffer.readBitmapAsImage();
22     if (image) {
23         return SkImageSource::Make(std::move(image), src, dst, filterQuality);
24     }
25     return nullptr;
26 }
27