c0bd9f9fe5
Current strategy: everything from the top Things to look at first are the manual changes: - added tools/rewrite_includes.py - removed -Idirectives from BUILD.gn - various compile.sh simplifications - tweak tools/embed_resources.py - update gn/find_headers.py to write paths from the top - update gn/gn_to_bp.py SkUserConfig.h layout so that #include "include/config/SkUserConfig.h" always gets the header we want. No-Presubmit: true Change-Id: I73a4b181654e0e38d229bc456c0d0854bae3363e Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209706 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Hal Canary <halcanary@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org>
73 lines
2.6 KiB
C++
73 lines
2.6 KiB
C++
/*
|
|
* Copyright 2017 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#include "include/core/SkPoint3.h"
|
|
#include "include/core/SkRefCnt.h"
|
|
|
|
#ifndef SkAtlasTextRenderer_DEFINED
|
|
#define SkAtlasTextRenderer_DEFINED
|
|
|
|
/**
|
|
* This is the base class for a renderer implemented by the SkAtlasText client. The
|
|
* SkAtlasTextContext issues texture creations, deletions, uploads, and vertex draws to the
|
|
* renderer. The renderer must perform those actions in the order called to correctly render
|
|
* the text drawn to SkAtlasTextTargets.
|
|
*/
|
|
class SK_API SkAtlasTextRenderer : public SkRefCnt {
|
|
public:
|
|
enum class AtlasFormat {
|
|
/** Unsigned normalized 8 bit single channel format. */
|
|
kA8
|
|
};
|
|
|
|
struct SDFVertex {
|
|
/** Position in device space (not normalized). The third component is w (not z). */
|
|
SkPoint3 fPosition;
|
|
/** Color, same value for all four corners of a glyph quad. */
|
|
uint32_t fColor;
|
|
/** Texture coordinate (in texel units, not normalized). */
|
|
int16_t fTextureCoordX;
|
|
int16_t fTextureCoordY;
|
|
};
|
|
|
|
virtual ~SkAtlasTextRenderer() = default;
|
|
|
|
/**
|
|
* Create a texture of the provided format with dimensions 'width' x 'height'
|
|
* and return a unique handle.
|
|
*/
|
|
virtual void* createTexture(AtlasFormat, int width, int height) = 0;
|
|
|
|
/**
|
|
* Delete the texture with the passed handle.
|
|
*/
|
|
virtual void deleteTexture(void* textureHandle) = 0;
|
|
|
|
/**
|
|
* Place the pixel data specified by 'data' in the texture with handle
|
|
* 'textureHandle' in the rectangle ['x', 'x' + 'width') x ['y', 'y' + 'height').
|
|
* 'rowBytes' specifies the byte offset between successive rows in 'data' and will always be
|
|
* a multiple of the number of bytes per pixel.
|
|
* The pixel format of data is the same as that of 'textureHandle'.
|
|
*/
|
|
virtual void setTextureData(void* textureHandle, const void* data, int x, int y, int width,
|
|
int height, size_t rowBytes) = 0;
|
|
|
|
/**
|
|
* Draws glyphs using SDFs. The SDF data resides in 'textureHandle'. The array
|
|
* 'vertices' provides interleaved device-space positions, colors, and
|
|
* texture coordinates. There are are 4 * 'quadCnt' entries in 'vertices'.
|
|
*/
|
|
virtual void drawSDFGlyphs(void* targetHandle, void* textureHandle, const SDFVertex vertices[],
|
|
int quadCnt) = 0;
|
|
|
|
/** Called when a SkAtlasTextureTarget is destroyed. */
|
|
virtual void targetDeleted(void* targetHandle) = 0;
|
|
};
|
|
|
|
#endif
|