refactor: move gfx::ImageSkia functions to their own util file (#19460)

* initial refactor

* fix lint

* 🚚🚚🚚🚚🚚

* change year in copyright?

* lint more

* remove bad code

* add missing header

* fix: add missing ifdef guard

* fix variable call
This commit is contained in:
Erick Zhao 2019-07-30 13:49:25 -07:00 committed by Shelley Vohr
parent af3316707f
commit e74daf2d19
4 changed files with 223 additions and 140 deletions

44
shell/common/skia_util.h Normal file
View file

@ -0,0 +1,44 @@
// Copyright (c) 2019 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_COMMON_SKIA_UTIL_H_
#define SHELL_COMMON_SKIA_UTIL_H_
#include <string>
#include "ui/gfx/image/image_skia.h"
namespace electron {
namespace util {
bool PopulateImageSkiaRepsFromPath(gfx::ImageSkia* image,
const base::FilePath& path);
bool AddImageSkiaRepFromBuffer(gfx::ImageSkia* image,
const unsigned char* data,
size_t size,
int width,
int height,
double scale_factor);
bool AddImageSkiaRepFromJPEG(gfx::ImageSkia* image,
const unsigned char* data,
size_t size,
double scale_factor);
bool AddImageSkiaRepFromPNG(gfx::ImageSkia* image,
const unsigned char* data,
size_t size,
double scale_factor);
#if defined(OS_WIN)
bool ReadImageSkiaFromICO(gfx::ImageSkia* image, HICON icon);
#endif
} // namespace util
} // namespace electron
#endif // SHELL_COMMON_SKIA_UTIL_H_