summaryrefslogtreecommitdiff
path: root/chromium/skia/ext/skia_encode_image.cc
blob: bb6820fcdf585a800a4f915979289f4adcccfaeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright (c) 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "skia/ext/skia_encode_image.h"

#include "third_party/skia/include/core/SkImageEncoder.h"

static skia::ImageEncoderFunction g_image_encoder = nullptr;

void skia::SetImageEncoder(skia::ImageEncoderFunction image_encoder) {
  g_image_encoder = image_encoder;
}

bool SkEncodeImage(SkWStream* stream,
                   const SkPixmap& pixmap,
                   SkEncodedImageFormat format,
                   int quality) {
  skia::ImageEncoderFunction encoder = g_image_encoder;
  return encoder && encoder(stream, pixmap, format, quality);
}