[core] Reorganize sprite related files

This commit is contained in:
John Firebaugh
2015-11-05 15:05:43 -08:00
parent 0dc1519a18
commit 1e350b7ea4
30 changed files with 80 additions and 84 deletions

View File

@@ -1,5 +1,5 @@
#ifndef MBGL_ANNOTATIONS_SPRITE_IMAGE
#define MBGL_ANNOTATIONS_SPRITE_IMAGE
#ifndef MBGL_SPRITE_IMAGE
#define MBGL_SPRITE_IMAGE
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/geo.hpp>

View File

@@ -19,7 +19,7 @@
#include <mbgl/map/camera.hpp>
#include <mbgl/annotation/point_annotation.hpp>
#include <mbgl/annotation/shape_annotation.hpp>
#include <mbgl/annotation/sprite_image.hpp>
#include <mbgl/sprite/sprite_image.hpp>
#include <mbgl/platform/event.hpp>
#include <mbgl/platform/log.hpp>
#include <mbgl/storage/network_status.hpp>

View File

@@ -1,6 +1,6 @@
#include <mbgl/annotation/point_annotation.hpp>
#include <mbgl/annotation/shape_annotation.hpp>
#include <mbgl/annotation/sprite_image.hpp>
#include <mbgl/sprite/sprite_image.hpp>
#include <mbgl/platform/default/glfw_view.hpp>
#include <mbgl/platform/gl.hpp>
#include <mbgl/platform/log.hpp>

View File

@@ -10,7 +10,7 @@
#include <mbgl/mbgl.hpp>
#include <mbgl/annotation/point_annotation.hpp>
#include <mbgl/annotation/shape_annotation.hpp>
#include <mbgl/annotation/sprite_image.hpp>
#include <mbgl/sprite/sprite_image.hpp>
#include <mbgl/map/camera.hpp>
#include <mbgl/platform/platform.hpp>
#include <mbgl/platform/darwin/reachability.h>

View File

@@ -2,7 +2,6 @@
#include <mbgl/map/map_data.hpp>
#include <mbgl/map/view.hpp>
#include <mbgl/map/still_image.hpp>
#include <mbgl/annotation/sprite_store.hpp>
#include <mbgl/platform/log.hpp>
@@ -12,10 +11,11 @@
#include <mbgl/storage/resource.hpp>
#include <mbgl/storage/response.hpp>
#include <mbgl/geometry/sprite_atlas.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/sprite/sprite_atlas.hpp>
#include <mbgl/sprite/sprite_store.hpp>
#include <mbgl/util/gl_object_store.hpp>
#include <mbgl/util/uv_detail.hpp>
#include <mbgl/util/worker.hpp>

View File

@@ -4,7 +4,7 @@
#include <mbgl/style/style.hpp>
#include <mbgl/style/style_layer.hpp>
#include <mbgl/style/style_bucket_parameters.hpp>
#include <mbgl/geometry/sprite_atlas.hpp>
#include <mbgl/sprite/sprite_atlas.hpp>
#include <mbgl/geometry/glyph_atlas.hpp>
#include <mbgl/renderer/symbol_bucket.hpp>
#include <mbgl/platform/log.hpp>

View File

@@ -13,7 +13,7 @@
#include <mbgl/layer/background_layer.hpp>
#include <mbgl/geometry/sprite_atlas.hpp>
#include <mbgl/sprite/sprite_atlas.hpp>
#include <mbgl/geometry/line_atlas.hpp>
#include <mbgl/geometry/glyph_atlas.hpp>

View File

@@ -3,7 +3,6 @@
#include <mbgl/layer/circle_layer.hpp>
#include <mbgl/map/sprite.hpp>
#include <mbgl/map/tile_id.hpp>
#include <mbgl/map/map_data.hpp>

View File

@@ -1,9 +1,8 @@
#include <mbgl/renderer/painter.hpp>
#include <mbgl/renderer/fill_bucket.hpp>
#include <mbgl/layer/fill_layer.hpp>
#include <mbgl/map/sprite.hpp>
#include <mbgl/map/tile_id.hpp>
#include <mbgl/geometry/sprite_atlas.hpp>
#include <mbgl/sprite/sprite_atlas.hpp>
#include <mbgl/shader/outline_shader.hpp>
#include <mbgl/shader/pattern_shader.hpp>
#include <mbgl/shader/plain_shader.hpp>

View File

@@ -1,13 +1,12 @@
#include <mbgl/renderer/painter.hpp>
#include <mbgl/renderer/line_bucket.hpp>
#include <mbgl/layer/line_layer.hpp>
#include <mbgl/map/sprite.hpp>
#include <mbgl/map/tile_id.hpp>
#include <mbgl/map/map_data.hpp>
#include <mbgl/shader/line_shader.hpp>
#include <mbgl/shader/linesdf_shader.hpp>
#include <mbgl/shader/linepattern_shader.hpp>
#include <mbgl/geometry/sprite_atlas.hpp>
#include <mbgl/sprite/sprite_atlas.hpp>
#include <mbgl/geometry/line_atlas.hpp>
#include <mbgl/util/mat2.hpp>

View File

@@ -2,7 +2,7 @@
#include <mbgl/renderer/symbol_bucket.hpp>
#include <mbgl/layer/symbol_layer.hpp>
#include <mbgl/geometry/glyph_atlas.hpp>
#include <mbgl/geometry/sprite_atlas.hpp>
#include <mbgl/sprite/sprite_atlas.hpp>
#include <mbgl/shader/sdf_shader.hpp>
#include <mbgl/shader/icon_shader.hpp>
#include <mbgl/shader/box_shader.hpp>

View File

@@ -1,11 +1,12 @@
#include <mbgl/renderer/symbol_bucket.hpp>
#include <mbgl/layer/symbol_layer.hpp>
#include <mbgl/map/geometry_tile.hpp>
#include <mbgl/annotation/sprite_image.hpp>
#include <mbgl/sprite/sprite.hpp>
#include <mbgl/sprite/sprite_image.hpp>
#include <mbgl/sprite/sprite_atlas.hpp>
#include <mbgl/geometry/text_buffer.hpp>
#include <mbgl/geometry/icon_buffer.hpp>
#include <mbgl/geometry/glyph_atlas.hpp>
#include <mbgl/geometry/sprite_atlas.hpp>
#include <mbgl/geometry/anchor.hpp>
#include <mbgl/text/get_anchors.hpp>
#include <mbgl/renderer/painter.hpp>
@@ -16,7 +17,6 @@
#include <mbgl/shader/sdf_shader.hpp>
#include <mbgl/shader/icon_shader.hpp>
#include <mbgl/shader/box_shader.hpp>
#include <mbgl/map/sprite.hpp>
#include <mbgl/util/utf.hpp>
#include <mbgl/util/token.hpp>

View File

@@ -1,5 +1,4 @@
#include <mbgl/map/sprite.hpp>
#include <mbgl/sprite/sprite.hpp>
#include <mbgl/platform/log.hpp>
#include <mbgl/platform/platform.hpp>
#include <mbgl/storage/file_source.hpp>

View File

@@ -1,7 +1,7 @@
#ifndef MBGL_STYLE_SPRITE
#define MBGL_STYLE_SPRITE
#ifndef MBGL_SPRITE
#define MBGL_SPRITE
#include <mbgl/annotation/sprite_parser.hpp>
#include <mbgl/sprite/sprite_parser.hpp>
#include <mbgl/util/image.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/ptr.hpp>

View File

@@ -1,5 +1,5 @@
#include <mbgl/geometry/sprite_atlas.hpp>
#include <mbgl/annotation/sprite_store.hpp>
#include <mbgl/sprite/sprite_atlas.hpp>
#include <mbgl/sprite/sprite_store.hpp>
#include <mbgl/platform/gl.hpp>
#include <mbgl/platform/log.hpp>
#include <mbgl/platform/platform.hpp>
@@ -10,7 +10,7 @@
#include <mbgl/util/scaling.hpp>
#include <mbgl/util/thread_context.hpp>
#include <mbgl/map/sprite.hpp>
#include <mbgl/sprite/sprite.hpp>
#include <cassert>
#include <cmath>

View File

@@ -1,5 +1,5 @@
#ifndef MBGL_GEOMETRY_SPRITE_ATLAS
#define MBGL_GEOMETRY_SPRITE_ATLAS
#ifndef MBGL_SPRITE_ATLAS
#define MBGL_SPRITE_ATLAS
#include <mbgl/geometry/binpack.hpp>
#include <mbgl/platform/gl.hpp>

View File

@@ -1,4 +1,4 @@
#include <mbgl/annotation/sprite_image.hpp>
#include <mbgl/sprite/sprite_image.hpp>
#include <mbgl/util/exception.hpp>

View File

@@ -1,5 +1,5 @@
#include <mbgl/annotation/sprite_parser.hpp>
#include <mbgl/annotation/sprite_image.hpp>
#include <mbgl/sprite/sprite_parser.hpp>
#include <mbgl/sprite/sprite_image.hpp>
#include <mbgl/platform/log.hpp>

View File

@@ -1,5 +1,5 @@
#ifndef MBGL_ANNOTATIONS_SPRITE_PARSER
#define MBGL_ANNOTATIONS_SPRITE_PARSER
#ifndef MBGL_SPRITE_PARSER
#define MBGL_SPRITE_PARSER
#include <mapbox/variant.hpp>

View File

@@ -1,4 +1,4 @@
#include <mbgl/annotation/sprite_store.hpp>
#include <mbgl/sprite/sprite_store.hpp>
#include <mbgl/platform/log.hpp>

View File

@@ -1,7 +1,7 @@
#ifndef MBGL_ANNOTATION_SPRITE_STORE
#define MBGL_ANNOTATION_SPRITE_STORE
#ifndef MBGL_SPRITE_STORE
#define MBGL_SPRITE_STORE
#include <mbgl/annotation/sprite_image.hpp>
#include <mbgl/sprite/sprite_image.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/geo.hpp>

View File

@@ -1,9 +1,10 @@
#include <mbgl/style/style.hpp>
#include <mbgl/map/sprite.hpp>
#include <mbgl/map/map_data.hpp>
#include <mbgl/map/source.hpp>
#include <mbgl/map/transform_state.hpp>
#include <mbgl/annotation/sprite_store.hpp>
#include <mbgl/sprite/sprite.hpp>
#include <mbgl/sprite/sprite_store.hpp>
#include <mbgl/sprite/sprite_atlas.hpp>
#include <mbgl/style/style_layer.hpp>
#include <mbgl/style/style_parser.hpp>
#include <mbgl/style/property_transition.hpp>
@@ -11,7 +12,6 @@
#include <mbgl/style/style_cascade_parameters.hpp>
#include <mbgl/style/style_calculation_parameters.hpp>
#include <mbgl/geometry/glyph_atlas.hpp>
#include <mbgl/geometry/sprite_atlas.hpp>
#include <mbgl/geometry/line_atlas.hpp>
#include <mbgl/util/constants.hpp>
#include <mbgl/platform/log.hpp>

View File

@@ -5,7 +5,7 @@
#include <mbgl/style/zoom_history.hpp>
#include <mbgl/map/source.hpp>
#include <mbgl/map/sprite.hpp>
#include <mbgl/sprite/sprite.hpp>
#include <mbgl/text/glyph_store.hpp>
#include <mbgl/util/ptr.hpp>

View File

@@ -4,7 +4,7 @@
#include <mbgl/map/map.hpp>
#include <mbgl/map/still_image.hpp>
#include <mbgl/util/image.hpp>
#include <mbgl/annotation/sprite_image.hpp>
#include <mbgl/sprite/sprite_image.hpp>
#include <mbgl/util/io.hpp>
@@ -16,7 +16,7 @@
using namespace mbgl;
TEST(Headless, CustomSpriteImages) {
TEST(Sprite, CustomSpriteImages) {
FixtureLog log;
auto display = std::make_shared<mbgl::HeadlessDisplay>();

View File

@@ -2,7 +2,7 @@
#include "../fixtures/mock_file_source.hpp"
#include "../fixtures/util.hpp"
#include <mbgl/map/sprite.hpp>
#include <mbgl/sprite/sprite.hpp>
#include <mbgl/util/run_loop.hpp>
#include <mbgl/util/thread.hpp>

View File

@@ -1,15 +1,15 @@
#include "../fixtures/util.hpp"
#include "../fixtures/fixture_log_observer.hpp"
#include <mbgl/geometry/sprite_atlas.hpp>
#include <mbgl/annotation/sprite_store.hpp>
#include <mbgl/annotation/sprite_parser.hpp>
#include <mbgl/sprite/sprite_atlas.hpp>
#include <mbgl/sprite/sprite_store.hpp>
#include <mbgl/sprite/sprite_parser.hpp>
#include <mbgl/util/io.hpp>
#include <mbgl/util/image.hpp>
using namespace mbgl;
TEST(Annotations, SpriteAtlas) {
TEST(Sprite, SpriteAtlas) {
FixtureLog log;
auto spriteParseResult = parseSprite(util::read_file("test/fixtures/annotations/emerald.png"),
@@ -86,7 +86,7 @@ TEST(Annotations, SpriteAtlas) {
// util::compress_png(atlas.getTextureWidth(), atlas.getTextureHeight(), atlas.getData()));
}
TEST(Annotations, SpriteAtlasSize) {
TEST(Sprite, SpriteAtlasSize) {
auto spriteParseResult = parseSprite(util::read_file("test/fixtures/annotations/emerald.png"),
util::read_file("test/fixtures/annotations/emerald.json"));
@@ -123,7 +123,7 @@ TEST(Annotations, SpriteAtlasSize) {
// util::compress_png(atlas.getTextureWidth(), atlas.getTextureHeight(), atlas.getData()));
}
TEST(Annotations, SpriteAtlasUpdates) {
TEST(Sprite, SpriteAtlasUpdates) {
SpriteStore store;
SpriteAtlas atlas(32, 32, 1, store);

View File

@@ -1,11 +1,11 @@
#include "../fixtures/util.hpp"
#include <mbgl/annotation/sprite_image.hpp>
#include <mbgl/sprite/sprite_image.hpp>
#include <mbgl/util/exception.hpp>
using namespace mbgl;
TEST(Annotations, SpriteImageZeroWidth) {
TEST(Sprite, SpriteImageZeroWidth) {
try {
SpriteImage(0, 16, 2, "");
FAIL() << "Expected exception";
@@ -14,7 +14,7 @@ TEST(Annotations, SpriteImageZeroWidth) {
}
}
TEST(Annotations, SpriteImageZeroHeight) {
TEST(Sprite, SpriteImageZeroHeight) {
try {
SpriteImage(16, 0, 2, "");
FAIL() << "Expected exception";
@@ -23,7 +23,7 @@ TEST(Annotations, SpriteImageZeroHeight) {
}
}
TEST(Annotations, SpriteImageZeroRatio) {
TEST(Sprite, SpriteImageZeroRatio) {
try {
SpriteImage(16, 16, 0, "");
FAIL() << "Expected exception";
@@ -32,7 +32,7 @@ TEST(Annotations, SpriteImageZeroRatio) {
}
}
TEST(Annotations, SpriteImageMismatchedData) {
TEST(Sprite, SpriteImageMismatchedData) {
try {
SpriteImage(16, 16, 2, "");
FAIL() << "Expected exception";
@@ -41,7 +41,7 @@ TEST(Annotations, SpriteImageMismatchedData) {
}
}
TEST(Annotations, SpriteImage) {
TEST(Sprite, SpriteImage) {
std::string pixels(32 * 24 * 4, '\0');
SpriteImage sprite(16, 12, 2, std::move(pixels));
EXPECT_EQ(16, sprite.width);
@@ -52,7 +52,7 @@ TEST(Annotations, SpriteImage) {
EXPECT_EQ(32u * 24 * 4, sprite.data.size());
}
TEST(Annotations, SpriteImageFractionalRatio) {
TEST(Sprite, SpriteImageFractionalRatio) {
std::string pixels(20 * 12 * 4, '\0');
SpriteImage sprite(13, 8, 1.5, std::move(pixels));
EXPECT_EQ(13, sprite.width);

View File

@@ -1,8 +1,8 @@
#include "../fixtures/util.hpp"
#include "../fixtures/fixture_log_observer.hpp"
#include <mbgl/annotation/sprite_parser.hpp>
#include <mbgl/annotation/sprite_image.hpp>
#include <mbgl/sprite/sprite_parser.hpp>
#include <mbgl/sprite/sprite_image.hpp>
#include <mbgl/util/image.hpp>
#include <mbgl/util/io.hpp>
@@ -10,7 +10,7 @@
using namespace mbgl;
TEST(Annotations, SpriteImageCreationInvalid) {
TEST(Sprite, SpriteImageCreationInvalid) {
FixtureLog log;
const util::Image image_1x(util::read_file("test/fixtures/annotations/emerald.png"));
@@ -33,7 +33,7 @@ TEST(Annotations, SpriteImageCreationInvalid) {
}));
}
TEST(Annotations, SpriteImageCreation1x) {
TEST(Sprite, SpriteImageCreation1x) {
const util::Image image_1x(util::read_file("test/fixtures/annotations/emerald.png"));
ASSERT_TRUE(image_1x);
ASSERT_EQ(200u, image_1x.getWidth());
@@ -73,7 +73,7 @@ TEST(Annotations, SpriteImageCreation1x) {
}
}
TEST(Annotations, SpriteImageCreation2x) {
TEST(Sprite, SpriteImageCreation2x) {
const util::Image image_2x(util::read_file("test/fixtures/annotations/emerald@2x.png"));
ASSERT_TRUE(image_2x);
@@ -88,7 +88,7 @@ TEST(Annotations, SpriteImageCreation2x) {
EXPECT_EQ(0x85F345098DD4F9E3u, test::crc64(sprite->data));
}
TEST(Annotations, SpriteImageCreation1_5x) {
TEST(Sprite, SpriteImageCreation1_5x) {
const util::Image image_2x(util::read_file("test/fixtures/annotations/emerald@2x.png"));
ASSERT_TRUE(image_2x);
@@ -113,7 +113,7 @@ TEST(Annotations, SpriteImageCreation1_5x) {
EXPECT_EQ(0x134A530C742DD141u, test::crc64(sprite2->data));
}
TEST(Annotations, SpriteParsing) {
TEST(Sprite, SpriteParsing) {
const auto image_1x = util::read_file("test/fixtures/annotations/emerald.png");
const auto json_1x = util::read_file("test/fixtures/annotations/emerald.json");
@@ -209,7 +209,7 @@ TEST(Annotations, SpriteParsing) {
}
}
TEST(Annotations, SpriteParsingInvalidJSON) {
TEST(Sprite, SpriteParsingInvalidJSON) {
const auto image_1x = util::read_file("test/fixtures/annotations/emerald.png");
const auto json_1x = R"JSON({ "image": " })JSON";
@@ -219,7 +219,7 @@ TEST(Annotations, SpriteParsingInvalidJSON) {
std::string("Failed to parse JSON: Missing a closing quotation mark in string. at offset 13"));
}
TEST(Annotations, SpriteParsingEmptyImage) {
TEST(Sprite, SpriteParsingEmptyImage) {
FixtureLog log;
const auto image_1x = util::read_file("test/fixtures/annotations/emerald.png");
@@ -236,7 +236,7 @@ TEST(Annotations, SpriteParsingEmptyImage) {
}));
}
TEST(Annotations, SpriteParsingSimpleWidthHeight) {
TEST(Sprite, SpriteParsingSimpleWidthHeight) {
FixtureLog log;
const auto image_1x = util::read_file("test/fixtures/annotations/emerald.png");
@@ -246,7 +246,7 @@ TEST(Annotations, SpriteParsingSimpleWidthHeight) {
EXPECT_EQ(1u, images.size());
}
TEST(Annotations, SpriteParsingWidthTooBig) {
TEST(Sprite, SpriteParsingWidthTooBig) {
FixtureLog log;
const auto image_1x = util::read_file("test/fixtures/annotations/emerald.png");
@@ -269,7 +269,7 @@ TEST(Annotations, SpriteParsingWidthTooBig) {
}));
}
TEST(Annotations, SpriteParsingNegativeWidth) {
TEST(Sprite, SpriteParsingNegativeWidth) {
FixtureLog log;
const auto image_1x = util::read_file("test/fixtures/annotations/emerald.png");
@@ -292,7 +292,7 @@ TEST(Annotations, SpriteParsingNegativeWidth) {
}));
}
TEST(Annotations, SpriteParsingNullRatio) {
TEST(Sprite, SpriteParsingNullRatio) {
FixtureLog log;
const auto image_1x = util::read_file("test/fixtures/annotations/emerald.png");

View File

@@ -1,11 +1,11 @@
#include "../fixtures/util.hpp"
#include "../fixtures/fixture_log_observer.hpp"
#include <mbgl/annotation/sprite_store.hpp>
#include <mbgl/sprite/sprite_store.hpp>
using namespace mbgl;
TEST(Annotations, SpriteStore) {
TEST(Sprite, SpriteStore) {
FixtureLog log;
const auto sprite1 = std::make_shared<SpriteImage>(8, 8, 2, std::string(16 * 16 * 4, '\0'));
@@ -71,7 +71,7 @@ TEST(Annotations, SpriteStore) {
EXPECT_EQ(Sprites(), store.getDirty());
}
TEST(Annotations, SpriteStoreOtherPixelRatio) {
TEST(Sprite, SpriteStoreOtherPixelRatio) {
FixtureLog log;
const auto sprite1 = std::make_shared<SpriteImage>(8, 8, 1, std::string(8 * 8 * 4, '\0'));
@@ -84,7 +84,7 @@ TEST(Annotations, SpriteStoreOtherPixelRatio) {
EXPECT_EQ(Sprites({ { "one", sprite1 } }), store.getDirty());
}
TEST(Annotations, SpriteStoreMultiple) {
TEST(Sprite, SpriteStoreMultiple) {
const auto sprite1 = std::make_shared<SpriteImage>(8, 8, 2, std::string(16 * 16 * 4, '\0'));
const auto sprite2 = std::make_shared<SpriteImage>(8, 8, 2, std::string(16 * 16 * 4, '\0'));
@@ -101,7 +101,7 @@ TEST(Annotations, SpriteStoreMultiple) {
EXPECT_EQ(Sprites(), store.getDirty());
}
TEST(Annotations, SpriteStoreReplace) {
TEST(Sprite, SpriteStoreReplace) {
FixtureLog log;
const auto sprite1 = std::make_shared<SpriteImage>(8, 8, 2, std::string(16 * 16 * 4, '\0'));
@@ -118,7 +118,7 @@ TEST(Annotations, SpriteStoreReplace) {
EXPECT_EQ(Sprites({ { "sprite", sprite2 } }), store.getDirty());
}
TEST(Annotations, SpriteStoreReplaceWithDifferentDimensions) {
TEST(Sprite, SpriteStoreReplaceWithDifferentDimensions) {
FixtureLog log;
const auto sprite1 = std::make_shared<SpriteImage>(8, 8, 2, std::string(16 * 16 * 4, '\0'));

View File

@@ -39,11 +39,6 @@
'miscellaneous/assert.cpp',
'annotations/sprite_atlas.cpp',
'annotations/sprite_image.cpp',
'annotations/sprite_store.cpp',
'annotations/sprite_parser.cpp',
'api/annotations.cpp',
'api/api_misuse.cpp',
'api/repeated_render.cpp',
@@ -54,7 +49,6 @@
'miscellaneous/binpack.cpp',
'miscellaneous/bilinear.cpp',
'miscellaneous/comparisons.cpp',
'miscellaneous/custom_sprites.cpp',
'miscellaneous/enums.cpp',
'miscellaneous/functions.cpp',
'miscellaneous/geo.cpp',
@@ -91,7 +85,13 @@
'style/glyph_store.cpp',
'style/pending_resources.cpp',
'style/resource_loading.cpp',
'style/sprite.cpp',
'sprite/sprite.cpp',
'sprite/sprite_atlas.cpp',
'sprite/sprite_image.cpp',
'sprite/sprite_parser.cpp',
'sprite/sprite_store.cpp',
'sprite/custom_sprites.cpp',
],
'libraries': [
'<@(gtest_static_libs)',