mirror of
https://github.com/google/pebble.git
synced 2025-07-15 18:46:41 -04:00
Merge ecfd50f991
into 4051c5bb97
This commit is contained in:
commit
74b93756f3
516 changed files with 1078 additions and 1078 deletions
|
@ -169,7 +169,7 @@ void handle_init(void) {
|
|||
|
||||
text_layer_set_text(text_layer, "? ? ?");
|
||||
|
||||
// Subscribe to mesages published by the worker
|
||||
// Subscribe to messages published by the worker
|
||||
app_worker_message_subscribe(steps_event_handler);
|
||||
|
||||
// Subscribe to second ticks
|
||||
|
|
|
@ -367,7 +367,7 @@ static void window_load(Window *window) {
|
|||
|
||||
layer_add_child(window_layer, menu_layer_get_layer(s_menu_layer));
|
||||
|
||||
// Start scanning. Advertisments will be delivered in the callback.
|
||||
// Start scanning. Advertisements will be delivered in the callback.
|
||||
toggle_scan();
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ static Animation *prv_create_custom_animation(void) {
|
|||
|
||||
|
||||
static void click_handler(ClickRecognizerRef recognizer, Window *window) {
|
||||
// If the animation is still running, fast-foward to 300ms from the end
|
||||
// If the animation is still running, fast-forward to 300ms from the end
|
||||
if (animation_is_scheduled(s_animation)) {
|
||||
uint32_t duration = animation_get_duration(s_animation, true, true);
|
||||
animation_set_elapsed(s_animation, duration - 300);
|
||||
|
@ -142,7 +142,7 @@ static void click_handler(ClickRecognizerRef recognizer, Window *window) {
|
|||
}
|
||||
|
||||
/*
|
||||
// Exmple animation parameters:
|
||||
// Example animation parameters:
|
||||
|
||||
// Duration defaults to 250 ms
|
||||
animation_set_duration(&prop_animation->animation, 1000);
|
||||
|
|
|
@ -179,7 +179,7 @@ static void prv_window_load(Window *window) {
|
|||
// one image at the top left .topleft_layer,
|
||||
// and two menu layers .action_list1 and .action_list2 that overlay each other
|
||||
|
||||
// some hackery with the two menu layers goes on to keep their scroll offest in sync
|
||||
// some hackery with the two menu layers goes on to keep their scroll offset in sync
|
||||
// and to have the inverter layer rendered only once
|
||||
|
||||
const int16_t navbar_width = s_fps_topleft_bitmap.bounds.size.w;
|
||||
|
|
|
@ -1033,7 +1033,7 @@ static void prv_debug_cmd_heart_rate_api(int index, void *context) {
|
|||
goto exit;
|
||||
}
|
||||
|
||||
// Test registring and cancelling a metric alert
|
||||
// Test registering and cancelling a metric alert
|
||||
HealthMetricAlert *alert = health_service_register_metric_alert(HealthMetricHeartRateBPM, 10);
|
||||
APP_LOG(APP_LOG_LEVEL_DEBUG, "Result from register_metric_alert: %p", alert);
|
||||
if (alert == NULL) {
|
||||
|
|
|
@ -204,7 +204,7 @@ AppMessageResult app_message_open(const uint32_t size_inbound, const uint32_t si
|
|||
void app_message_close(void) {
|
||||
AppMessageCtx *app_message_ctx = app_state_get_app_message_ctx();
|
||||
|
||||
// TODO PBL-1634: handle the the return status when this function returns status.
|
||||
// TODO PBL-1634: handle the return status when this function returns status.
|
||||
// For now, continue to ignore failure.
|
||||
app_message_outbox_close(&app_message_ctx->outbox);
|
||||
app_message_inbox_close(&app_message_ctx->inbox);
|
||||
|
|
|
@ -344,7 +344,7 @@ void app_message_deregister_callbacks(void);
|
|||
|
||||
// -------- AppMessage Lifecycle ----------------------------------------------------------------------------------- //
|
||||
|
||||
//! Programatically determine the inbox size maximum in the current configuration.
|
||||
//! Programmatically determine the inbox size maximum in the current configuration.
|
||||
//!
|
||||
//! \return The inbox size maximum on this firmware.
|
||||
//!
|
||||
|
@ -353,7 +353,7 @@ void app_message_deregister_callbacks(void);
|
|||
//!
|
||||
uint32_t app_message_inbox_size_maximum(void);
|
||||
|
||||
//! Programatically determine the outbox size maximum in the current configuration.
|
||||
//! Programmatically determine the outbox size maximum in the current configuration.
|
||||
//!
|
||||
//! \return The outbox size maximum on this firmware.
|
||||
//!
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
|
||||
//! Error values which may be returned from the smartstrap APIs.
|
||||
typedef enum {
|
||||
//! No error occured.
|
||||
//! No error occurred.
|
||||
SmartstrapResultOk = 0,
|
||||
//! Invalid function arguments were supplied.
|
||||
SmartstrapResultInvalidArgs,
|
||||
|
@ -69,7 +69,7 @@ typedef enum {
|
|||
SmartstrapResultServiceUnavailable,
|
||||
//! The smartstrap reported that it does not support the requested attribute.
|
||||
SmartstrapResultAttributeUnsupported,
|
||||
//! A time-out occured during the request.
|
||||
//! A time-out occurred during the request.
|
||||
SmartstrapResultTimeOut,
|
||||
} SmartstrapResult;
|
||||
|
||||
|
@ -153,7 +153,7 @@ void app_smartstrap_set_timeout(uint16_t timeout_ms);
|
|||
//! @param attribute_id The AttributeId to create the attribute for.
|
||||
//! @param buffer_length The length of the internal buffer which will be used to store the read
|
||||
//! and write requests for this attribute.
|
||||
//! @returns The newly created SmartstrapAttribute or NULL if an internal error occured or if the
|
||||
//! @returns The newly created SmartstrapAttribute or NULL if an internal error occurred or if the
|
||||
//! specified length is greater than SMARTSTRAP_ATTRIBUTE_LENGTH_MAXIMUM.
|
||||
SmartstrapAttribute *app_smartstrap_attribute_create(SmartstrapServiceId service_id,
|
||||
SmartstrapAttributeId attribute_id,
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
//! @file fw/applib/app_timer.c
|
||||
//!
|
||||
//! Surpise! All this is is a dumb wrapper around evented_timer!
|
||||
//! Surprise! All this is is a dumb wrapper around evented_timer!
|
||||
|
||||
DEFINE_SYSCALL(AppTimer*, app_timer_register, uint32_t timeout_ms,
|
||||
AppTimerCallback callback,
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"",
|
||||
"Types are defined below with the following parameters: ",
|
||||
" name: The name of the type as it appears in our codebase. This type definition must ",
|
||||
" be visibile in one of the headers in the headers list below. ",
|
||||
" be visible in one of the headers in the headers list below. ",
|
||||
" size_2x: The size in bytes that should be used for legacy2 apps ",
|
||||
" size_3x: The size in bytes that should be used for 3.x apps ",
|
||||
" size_3x_padding: The amount of padding to add directly to this particular struct. ",
|
||||
|
|
|
@ -42,7 +42,7 @@ bool applib_resource_munmap_all();
|
|||
//! or for a given resource if will try to allocate data and load it into RAM instead.
|
||||
//! Have a look at \ref resource_load_byte_range_system for the discussion of arguments
|
||||
//! @param used_aligned True, if you want this function to allocate 7 extra bytes if it cannot mmap
|
||||
//! @return NULL, if the resource coudln't be memory-mapped or allocated
|
||||
//! @return NULL, if the resource couldn't be memory-mapped or allocated
|
||||
void *applib_resource_mmap_or_load(ResAppNum app_num, uint32_t resource_id,
|
||||
size_t offset, size_t length, bool used_aligned);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <bluetooth/bluetooth_types.h>
|
||||
|
||||
//! @file ble_ad_parse.h
|
||||
//! API to serialize and deserialize advertisment and scan response payloads.
|
||||
//! API to serialize and deserialize advertisement and scan response payloads.
|
||||
//!
|
||||
//! Inbound payloads, as received using the ble_scan.h public API, can be
|
||||
//! consumed/deserialized using the functions below.
|
||||
|
@ -81,7 +81,7 @@ bool ble_ad_get_tx_power_level(const BLEAdData *ad, int8_t *tx_power_level_out);
|
|||
size_t ble_ad_copy_local_name(const BLEAdData *ad,
|
||||
char *buffer, size_t size);
|
||||
|
||||
//! If the Local Name is present in the advertisment data, returns the number
|
||||
//! If the Local Name is present in the advertisement data, returns the number
|
||||
//! of bytes a C-string needs to be to hold the full name.
|
||||
//! @param ad The advertisement data
|
||||
//! @return The size of the Local Name in bytes, *including* zero terminator.
|
||||
|
@ -108,7 +108,7 @@ size_t ble_ad_copy_manufacturer_specific_data(const BLEAdData *ad,
|
|||
uint16_t *company_id_out,
|
||||
uint8_t *buffer, size_t size);
|
||||
|
||||
//! Gets the size in bytes of Manufacturer Specific data in the advertisment.
|
||||
//! Gets the size in bytes of Manufacturer Specific data in the advertisement.
|
||||
//! @param ad The advertisement data
|
||||
//! @return The size of the data, in bytes. If the Manufacturer Specific data is
|
||||
//! not present, zero is returned.
|
||||
|
|
|
@ -184,7 +184,7 @@ uint16_t ble_client_get_maximum_value_length(BTDevice device);
|
|||
//! @return BTErrnoOK if the operation was successfully started, or ... TODO
|
||||
BTErrno ble_client_read(BLECharacteristic characteristic);
|
||||
|
||||
//! Write the value of a characterstic.
|
||||
//! Write the value of a characteristic.
|
||||
//! A call to this function will result in a callback to the registered
|
||||
//! BLEClientWriteHandler handler. @see ble_client_set_write_response_handler.
|
||||
//! @param characteristic The characteristic for which to write the value
|
||||
|
@ -196,7 +196,7 @@ BTErrno ble_client_write(BLECharacteristic characteristic,
|
|||
const uint8_t *value,
|
||||
size_t value_length);
|
||||
|
||||
//! Write the value of a characterstic without response.
|
||||
//! Write the value of a characteristic without response.
|
||||
//! @param characteristic The characteristic for which to write the value
|
||||
//! @param value Buffer with the value to write
|
||||
//! @param value_length Number of bytes to write
|
||||
|
@ -234,7 +234,7 @@ BTErrno ble_client_write_without_response(BLECharacteristic characteristic,
|
|||
//! @note Under the hood, this API writes to the Client Characteristic
|
||||
//! Configuration Descriptor's Notifications or Indications enabled/disabled
|
||||
//! bit.
|
||||
//! @return BTErrnoOK if the subscription request was sent sucessfully, or
|
||||
//! @return BTErrnoOK if the subscription request was sent successfully, or
|
||||
//! TODO...
|
||||
BTErrno ble_client_subscribe(BLECharacteristic characteristic,
|
||||
BLESubscription subscription_type);
|
||||
|
|
|
@ -45,7 +45,7 @@ typedef struct {
|
|||
|
||||
//! The calibrated power of the iBeacon. This is the RSSI measured at 1 meter
|
||||
//! distance from the iBeacon. The iBeacon transmits this information in its
|
||||
//! advertisment. Using this and the actual RSSI, the distance is estimated.
|
||||
//! advertisement. Using this and the actual RSSI, the distance is estimated.
|
||||
int8_t calibrated_tx_power;
|
||||
} BLEiBeacon;
|
||||
|
||||
|
@ -90,7 +90,7 @@ void ble_ibeacon_destroy(BLEiBeacon *ibeacon);
|
|||
//! @param rssi The RSSI of the advertisement
|
||||
//! @param[out] ibeacon_out Will contain the parsed iBeacon data if the call
|
||||
//! returns true.
|
||||
//! @return true if the data element was succesfully parsed as iBeacon,
|
||||
//! @return true if the data element was successfully parsed as iBeacon,
|
||||
//! false if the data element could not be parsed as iBeacon.
|
||||
bool ble_ibeacon_parse(const BLEAdData *ad, int8_t rssi,
|
||||
BLEiBeacon *ibeacon_out);
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
|
||||
#include <bluetooth/bluetooth_types.h>
|
||||
|
||||
//! Callback that is called for each advertisment that is found while scanning
|
||||
//! Callback that is called for each advertisement that is found while scanning
|
||||
//! using ble_scan_start().
|
||||
//! @param device The device from which the advertisment originated.
|
||||
//! @param device The device from which the advertisement originated.
|
||||
//! @param rssi The RSSI (Received Signal Strength Indication) of the
|
||||
//! advertisement.
|
||||
//! @param advertisement_data The payload of the advertisement. When there was
|
||||
|
@ -38,7 +38,7 @@ typedef void (*BLEScanHandler)(BTDevice device,
|
|||
|
||||
//! Start scanning for advertisements. Pebble will scan actively, meaning it
|
||||
//! will perform scan requests whenever the advertisement is scannable.
|
||||
//! @param handler The callback to handle the found advertisments. It must not
|
||||
//! @param handler The callback to handle the found advertisements. It must not
|
||||
//! be NULL.
|
||||
//! @return BTErrnoOK if scanning started successfully, BTErrnoInvalidParameter
|
||||
//! if the handler was invalid or BTErrnoInvalidState if scanning had already
|
||||
|
|
|
@ -39,7 +39,7 @@ uint8_t ble_service_get_characteristics(BLEService service,
|
|||
//! @return The 128-bit Service UUID, or UUID_INVALID if the service reference
|
||||
//! was invalid.
|
||||
//! @note The returned UUID is always a 128-bit UUID, even if the device
|
||||
//! its interal GATT service database uses 16-bit or 32-bit Service UUIDs.
|
||||
//! its internal GATT service database uses 16-bit or 32-bit Service UUIDs.
|
||||
//! @see bt_uuid_expand_16bit for a macro that converts 16-bit UUIDs to 128-bit
|
||||
//! equivalents.
|
||||
//! @see bt_uuid_expand_32bit for a macro that converts 32-bit UUIDs to 128-bit
|
||||
|
|
|
@ -125,10 +125,10 @@ void data_logging_finish(DataLoggingSessionRef logging_session);
|
|||
//! DATA_LOGGING_NOT_FOUND if the logging session is invalid
|
||||
//!
|
||||
//! @return
|
||||
//! DATA_LOGGING_CLOSED if the sesion is not active
|
||||
//! DATA_LOGGING_CLOSED if the session is not active
|
||||
//!
|
||||
//! @return
|
||||
//! DATA_LOGGING_BUSY if the sesion is not available for writing
|
||||
//! DATA_LOGGING_BUSY if the session is not available for writing
|
||||
//!
|
||||
//! @return
|
||||
//! DATA_LOGGING_INVALID_PARAMS if num_items is 0 or data is NULL
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
*/
|
||||
|
||||
//! @file framebuffer.c
|
||||
//! Bitdepth independant routines for framebuffer.h
|
||||
//! Bitdepth depenedant routines can be found in the 1_bit & 8_bit folders in their
|
||||
//! Bitdepth independent routines for framebuffer.h
|
||||
//! Bitdepth dependent routines can be found in the 1_bit & 8_bit folders in their
|
||||
//! respective framebuffer.c files.
|
||||
|
||||
#include "applib/graphics/framebuffer.h"
|
||||
|
|
|
@ -145,7 +145,7 @@ void gbitmap_init_with_data(GBitmap *bitmap, const uint8_t *data) {
|
|||
bitmap->info.is_bitmap_heap_allocated = false;
|
||||
|
||||
// Note that our container contains values for the origin, but we want to ignore them.
|
||||
// This is because orginally we just serialized GBitmap to disk,
|
||||
// This is because originally we just serialized GBitmap to disk,
|
||||
// but these fields don't really make sense for static images.
|
||||
// These origin fields are only used when reusing a byte buffer in a sub bitmap.
|
||||
// This allows us to have a shallow copy of a portion of a parent bitmap.
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
//! (width by height) and the first bit of image data is the pixel at (0, 0),
|
||||
//! then the bounds.size would be `GSize(29, 5)` and bounds.origin would be `GPoint(0, 0)`.
|
||||
//! 
|
||||
//! In the illustration each pixel is a representated as a square. The white
|
||||
//! In the illustration each pixel is a represented as a square. The white
|
||||
//! squares are the bits that are used, the gray squares are the padding bits, because
|
||||
//! each row of image data has to be a multiple of 4 bytes (32 bits).
|
||||
//! The numbers in the column in the left are the offsets (in bytes) from the `*addr`
|
||||
|
@ -54,7 +54,7 @@
|
|||
//! 
|
||||
//!
|
||||
//! - \ref GBitmapFormat8Bit:
|
||||
//! Each pixel in the bitmap is represented by 1 byte. The color value of that byte correspends to
|
||||
//! Each pixel in the bitmap is represented by 1 byte. The color value of that byte corresponds to
|
||||
//! a GColor.argb value.
|
||||
//! There is no restriction on row_size_bytes / stride.
|
||||
//!
|
||||
|
|
|
@ -288,7 +288,7 @@ bool gbitmap_sequence_update_bitmap_next_frame(GBitmapSequence *bitmap_sequence,
|
|||
const bool bitmap_supports_transparency = (bitmap_format != GBitmapFormat1Bit);
|
||||
|
||||
// DISPOSE_OP_BACKGROUND sets the background to black with transparency (0x00)
|
||||
// If we don't support tranparency, just do nothing.
|
||||
// If we don't support transparency, just do nothing.
|
||||
if (bitmap_supports_transparency &&
|
||||
(png_decoder_data->last_dispose_op == APNG_DISPOSE_OP_BACKGROUND)) {
|
||||
const uint32_t y_origin = bitmap->bounds.origin.y + png_decoder_data->previous_yoffset;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
#include "gtypes.h"
|
||||
|
||||
//! This is used for performaing backward-compatibility conversions with 1-bit GColors.
|
||||
//! This is used for performing backward-compatibility conversions with 1-bit GColors.
|
||||
GColor8 get_native_color(GColor2 color) {
|
||||
switch (color) {
|
||||
case GColor2Black:
|
||||
|
|
|
@ -71,7 +71,7 @@ typedef enum {
|
|||
typedef struct {
|
||||
//! Describes how to treat the range between .min_x and .max_x
|
||||
GDrawMaskRowInfoType type;
|
||||
//! Left-most pixel, 3.0 means that that pixel 3 is fully visible, 3.5 means it's half visible
|
||||
//! Left-most pixel, 3.0 means that pixel 3 is fully visible, 3.5 means it's half visible
|
||||
Fixed_S16_3 min_x;
|
||||
//! Right-most pixel, 10.7 means that pixel 10 is fully opaque
|
||||
Fixed_S16_3 max_x;
|
||||
|
@ -230,8 +230,8 @@ void graphics_context_mask_destroy(GContext *ctx, GDrawMask *mask);
|
|||
GSize graphics_context_get_framebuffer_size(GContext *ctx);
|
||||
|
||||
//! @internal
|
||||
//! Retreives the destination bitmap for the graphics context.
|
||||
//! @param ctx The graphics context to retreive the bitmap for.
|
||||
//! Retrieves the destination bitmap for the graphics context.
|
||||
//! @param ctx The graphics context to retrieve the bitmap for.
|
||||
GBitmap* graphics_context_get_bitmap(GContext* ctx);
|
||||
|
||||
//! @internal
|
||||
|
|
|
@ -74,7 +74,7 @@ bool gdraw_command_image_validate(GDrawCommandImage *image, size_t size);
|
|||
//! @param offset Offset from draw context origin to draw the image
|
||||
void gdraw_command_image_draw(GContext *ctx, GDrawCommandImage *image, GPoint offset);
|
||||
|
||||
//! Draw an image after being processed by the passed in proccessor
|
||||
//! Draw an image after being processed by the passed in processor
|
||||
//! @param ctx The destination graphics context in which to draw
|
||||
//! @param image Image to draw
|
||||
//! @param offset Offset from draw context origin to draw the image
|
||||
|
|
|
@ -40,7 +40,7 @@ typedef struct GDrawCommandProcessor GDrawCommandProcessor;
|
|||
|
||||
//! Callback for iterating over GDrawCommands
|
||||
//! @param processor GDrawCommandProcessor that is currently iterating over the GDrawCommandList.
|
||||
//! @param proccessed_command Copy of the current GDrawCommand that can be modified
|
||||
//! @param processed_command Copy of the current GDrawCommand that can be modified
|
||||
//! @param processed_command_max_size Size of GDrawCommand being processed
|
||||
//! @param list list of GDrawCommands that will be modified by the processor
|
||||
//! @param command Current GDrawCommand being processed
|
||||
|
@ -123,7 +123,7 @@ size_t gdraw_command_list_get_data_size(GDrawCommandList *command_list);
|
|||
//! The order is guaranteed to be the definition order of the points
|
||||
//! @param command_list \ref GDrawCommandList from which to collect points
|
||||
//! @param is_precise true to convert to GPointPrecise, otherwise points are converted to GPoint
|
||||
//! @param num_points_out Optinal pointer to uint16_t to receive the num points
|
||||
//! @param num_points_out Optional pointer to uint16_t to receive the num points
|
||||
GPoint *gdraw_command_list_collect_points(GDrawCommandList *command_list, bool is_precise,
|
||||
uint16_t *num_points_out);
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ void gpath_init(GPath *path, const GPathInfo *init) {
|
|||
|
||||
GPath* gpath_create(const GPathInfo *init) {
|
||||
// Can't pad this out because the definition itself is exported. Even if we did pad it out so
|
||||
// we can theoretically add members to the end of the struct, we'll still have to add compatibilty
|
||||
// we can theoretically add members to the end of the struct, we'll still have to add compatibility
|
||||
// flags throughout here to check which size of struct the app is going to pass us through these
|
||||
// APIs.
|
||||
GPath* path = applib_malloc(sizeof(GPath));
|
||||
|
|
|
@ -239,7 +239,7 @@ void graphics_fill_round_rect(GContext* ctx, const GRect *rect, uint16_t radius,
|
|||
|
||||
#if PBL_COLOR
|
||||
if (ctx->draw_state.antialiased) {
|
||||
// Antialiased (not suppported on 1-bit color)
|
||||
// Antialiased (not supported on 1-bit color)
|
||||
prv_fill_rect_aa(ctx, rect, radius, corner_mask, ctx->draw_state.fill_color);
|
||||
return;
|
||||
}
|
||||
|
@ -437,7 +437,7 @@ void graphics_draw_round_rect(GContext* ctx, const GRect *rect, uint16_t radius)
|
|||
prv_draw_round_rect_aa_stroked(ctx, rect, radius, ctx->draw_state.stroke_width);
|
||||
return;
|
||||
} else {
|
||||
// Antialiased and Stroke Width == 1 (not suppported on 1-bit color)
|
||||
// Antialiased and Stroke Width == 1 (not supported on 1-bit color)
|
||||
// Note: stroke width == 2 is rounded down to stroke width of 1
|
||||
prv_draw_round_rect_aa(ctx, rect, radius);
|
||||
return;
|
||||
|
|
|
@ -127,13 +127,13 @@ T_STATIC GColor get_bitmap_color(GBitmap *bmp, int x, int y) {
|
|||
0, // y = 0 when using data_row
|
||||
bmp->row_size_bytes,
|
||||
src_bpp);
|
||||
// Default color to be the raw color index - update only if palletized
|
||||
// Default color to be the raw color index - update only if palettized
|
||||
GColor src_color = (GColor){.argb = cindex};
|
||||
bool palletized = ((format == GBitmapFormat1BitPalette) ||
|
||||
bool palettized = ((format == GBitmapFormat1BitPalette) ||
|
||||
(format == GBitmapFormat2BitPalette) ||
|
||||
(format == GBitmapFormat4BitPalette));
|
||||
if (palletized) {
|
||||
// Look up color in pallete if palletized
|
||||
if (palettized) {
|
||||
// Look up color in palette if palettized
|
||||
const GColor *palette = bmp->palette;
|
||||
src_color = palette[cindex];
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ void graphics_draw_rotated_bitmap(GContext* ctx, GBitmap *src, GPoint src_ic, in
|
|||
background = GColorWhite;
|
||||
break;
|
||||
default:
|
||||
PBL_ASSERT(0, "unknown coposting mode %d", compositing_mode);
|
||||
PBL_ASSERT(0, "unknown compositing mode %d", compositing_mode);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -215,7 +215,7 @@ void graphics_draw_rotated_bitmap(GContext* ctx, GBitmap *src, GPoint src_ic, in
|
|||
const int32_t width = 2 * (max_width + 1); // Add one more pixel in case on the edge
|
||||
const int32_t height = 2 * (max_height + 1); // Add one more pixel in case on the edge
|
||||
|
||||
// add two pixels just in case of rounding isssues
|
||||
// add two pixels just in case of rounding issues
|
||||
const int32_t max_distance = integer_sqrt((width * width) + (height * height)) + 2;
|
||||
const int32_t min_x = src_ic.x - max_distance;
|
||||
const int32_t min_y = src_ic.y - max_distance;
|
||||
|
|
|
@ -80,7 +80,7 @@ static GPointPrecise prv_get_rotated_precise_point_for_ellipsis(GPointPrecise ce
|
|||
}
|
||||
}
|
||||
|
||||
// This algorthm operates on angle starting at our 90° mark, so we add 90°
|
||||
// This algorithm operates on angle starting at our 90° mark, so we add 90°
|
||||
// and flip x/y coordinates (see last line of this function)
|
||||
angle = (angle + (TRIG_MAX_ANGLE / 4)) % TRIG_MAX_ANGLE;
|
||||
|
||||
|
@ -179,7 +179,7 @@ static void prv_plot4(GBitmap *fb, GRect *clip_box, GPoint center, GPoint offset
|
|||
* |
|
||||
*
|
||||
* + center point
|
||||
* - x coordiante mirror line
|
||||
* - x coordinate mirror line
|
||||
* | y coordinate mirror line
|
||||
* x given offset point
|
||||
* xn mirrored points
|
||||
|
@ -209,7 +209,7 @@ static void prv_plot8(GBitmap *fb, GRect *clip_box, GPoint center, GPoint offset
|
|||
* / x5| x4 \
|
||||
*
|
||||
* + center point
|
||||
* - x coordiante mirror line
|
||||
* - x coordinate mirror line
|
||||
* | y coordinate mirror line
|
||||
* / 45 degree mirror line
|
||||
* \ 135 degree mirror line
|
||||
|
@ -228,7 +228,7 @@ T_STATIC void graphics_circle_quadrant_draw_1px_aa(GContext* ctx, GPoint p, uint
|
|||
GCornerMask quadrant) {
|
||||
/* This will draw antialiased circle with width of 1px, can be drawn in quadrants
|
||||
* Based on wu-xiang line drawing, will draw circle in two steps
|
||||
* 1. Calculate point on the edge of eighth of the cricle and plot it around by mirroring
|
||||
* 1. Calculate point on the edge of eighth of the circle and plot it around by mirroring
|
||||
* - if point is matching pixel perfectly thats going to be on fully colored pixel
|
||||
* - if theres fraction, two pixels will be colored accordingly
|
||||
* 2. Fill special case pixels (pixels that are between mirrored eighths)
|
||||
|
@ -256,7 +256,7 @@ T_STATIC void graphics_circle_quadrant_draw_1px_aa(GContext* ctx, GPoint p, uint
|
|||
* x -
|
||||
*
|
||||
* | original calculated pixels for plotting
|
||||
* - mirrored eight of the circle (will mirror more of them if neccessary)
|
||||
* - mirrored eight of the circle (will mirror more of them if necessary)
|
||||
* o special case pixels
|
||||
* x center of the circle
|
||||
*/
|
||||
|
@ -303,7 +303,7 @@ T_STATIC void graphics_circle_quadrant_draw_1px_aa(GContext* ctx, GPoint p, uint
|
|||
// Note: magic numbers explained in main comment for this function
|
||||
int special_case_pixels = 3;
|
||||
|
||||
// Acommpanied by magic number 7 (not 6, we increased radius at beginning of this function)
|
||||
// Accompanied by magic number 7 (not 6, we increased radius at beginning of this function)
|
||||
if (radius < 7) {
|
||||
// And sometimes magic number 2
|
||||
special_case_pixels = 2;
|
||||
|
@ -379,7 +379,7 @@ inline void prv_hline_quadrant(GCornerMask quadrant, GCornerMask desired, GConte
|
|||
|
||||
static void prv_stroke_circle_quadrant_full(GContext* ctx, GPoint p, uint16_t radius,
|
||||
uint8_t stroke_width, GCornerMask quadrant) {
|
||||
// This algorithm will draw stroked circle with vairable width (only odd numbers for now)
|
||||
// This algorithm will draw stroked circle with variable width (only odd numbers for now)
|
||||
const uint8_t half_stroke_width = stroke_width / 2;
|
||||
const int16_t inner_radius = radius - half_stroke_width;
|
||||
const uint8_t outer_radius = radius + half_stroke_width;
|
||||
|
@ -459,7 +459,7 @@ void graphics_circle_quadrant_draw(GContext* ctx, GPoint p, uint16_t radius, GCo
|
|||
graphics_circle_quadrant_draw_stroked_aa(ctx, p, radius, stroke_width, quadrant);
|
||||
return;
|
||||
} else {
|
||||
// Antialiased and Stroke Width == 1 (not suppported on 1-bit color)
|
||||
// Antialiased and Stroke Width == 1 (not supported on 1-bit color)
|
||||
graphics_circle_quadrant_draw_1px_aa(ctx, p, radius, quadrant);
|
||||
return;
|
||||
}
|
||||
|
@ -516,7 +516,7 @@ void graphics_draw_circle(GContext* ctx, GPoint p, uint16_t radius) {
|
|||
}
|
||||
|
||||
if (radius == 0) {
|
||||
// Special case radius 0 to fill a circle with radius eqaul to half the stroke width
|
||||
// Special case radius 0 to fill a circle with radius equal to half the stroke width
|
||||
// Backup the fill color and set that to the current stroke color since the fill color
|
||||
// is what is used for fill circle. Restore the fill color afterwards.
|
||||
GColor backup_fill_color = ctx->draw_state.fill_color;
|
||||
|
@ -835,7 +835,7 @@ static void prv_fill_oval_precise(GContext *ctx, GPointPrecise center,
|
|||
radius_inner_y.raw_value = MAX(radius_inner_y.raw_value, 0);
|
||||
|
||||
// This flag prevents from calculation of the inner circle (and bugs related to it)
|
||||
const bool no_innner_ellipsis = (radius_inner_x.raw_value == 0 || radius_inner_y.raw_value == 0);
|
||||
const bool no_inner_ellipsis = (radius_inner_x.raw_value == 0 || radius_inner_y.raw_value == 0);
|
||||
|
||||
// Squared radiuses values - they're used a lot in some cases
|
||||
const uint32_t radius_outer_x_sq =
|
||||
|
@ -857,16 +857,16 @@ static void prv_fill_oval_precise(GContext *ctx, GPointPrecise center,
|
|||
radius_outer_x.raw_value, radius_outer_y.raw_value,
|
||||
config.end_quadrant.angle);
|
||||
|
||||
GPointPrecise start_bottom = (no_innner_ellipsis) ? center :
|
||||
GPointPrecise start_bottom = (no_inner_ellipsis) ? center :
|
||||
prv_get_rotated_precise_point_for_ellipsis(center,
|
||||
radius_inner_x.raw_value, radius_inner_y.raw_value,
|
||||
config.start_quadrant.angle);
|
||||
GPointPrecise end_bottom = (no_innner_ellipsis) ? center :
|
||||
GPointPrecise end_bottom = (no_inner_ellipsis) ? center :
|
||||
prv_get_rotated_precise_point_for_ellipsis(center,
|
||||
radius_inner_x.raw_value, radius_inner_y.raw_value,
|
||||
config.end_quadrant.angle);
|
||||
|
||||
// Swapping top/bottom offset points if neccesary
|
||||
// Swapping top/bottom offset points if necessary
|
||||
if (start_top.y.raw_value > start_bottom.y.raw_value) {
|
||||
prv_swap_precise_points(&start_top, &start_bottom);
|
||||
} else if (start_top.y.raw_value == start_bottom.y.raw_value &&
|
||||
|
@ -883,15 +883,15 @@ static void prv_fill_oval_precise(GContext *ctx, GPointPrecise center,
|
|||
prv_swap_precise_points(&end_top, &end_bottom);
|
||||
}
|
||||
|
||||
// Range for scanline, since scanlines are mirred from the middle of the circle this is also
|
||||
// Range for scanline, since scanlines are mirrored from the middle of the circle this is also
|
||||
// indicated from the middle, therefore initialised with 0 (as middle) and
|
||||
// radius_y (as scalines are on y axis)
|
||||
// radius_y (as scanlines are on y axis)
|
||||
int draw_min = 0;
|
||||
int draw_max = radius_outer_y.integer;
|
||||
|
||||
// Adjust to drawing_box offset
|
||||
int adjusted_center = center.y.integer + ctx->draw_state.drawing_box.origin.y;
|
||||
// We add one to compenaste in case of odd line needs to be drawn
|
||||
// We add one to compensate in case of odd line needs to be drawn
|
||||
int adjusted_top = adjusted_center - radius_outer_y.integer - 1;
|
||||
int adjusted_bottom = adjusted_center + radius_outer_y.integer + 1;
|
||||
|
||||
|
@ -912,7 +912,7 @@ static void prv_fill_oval_precise(GContext *ctx, GPointPrecise center,
|
|||
int draw_max_top = MAX(center.y.integer - adjusted_top, 0);
|
||||
int draw_max_bottom = MAX(adjusted_bottom - center.y.integer, 0);
|
||||
int draw_min_top = MAX(center.y.integer - adjusted_bottom, 0);
|
||||
// In case of odd line, center is with half pixel so we have to subtract one more more full line
|
||||
// In case of odd line, center is with half pixel so we have to subtract one more full line
|
||||
int draw_min_bottom = MAX(adjusted_top - center.y.integer - 1, 0);
|
||||
|
||||
// Apply clipped distances
|
||||
|
@ -970,7 +970,7 @@ static void prv_fill_oval_precise(GContext *ctx, GPointPrecise center,
|
|||
int16_t left = center.x.raw_value - outer_edge;
|
||||
int16_t right = center.x.raw_value + outer_edge;
|
||||
|
||||
if (!no_innner_ellipsis && radius_inner_y.integer != 0) {
|
||||
if (!no_inner_ellipsis && radius_inner_y.integer != 0) {
|
||||
// This complicates the situation
|
||||
int16_t inner_edge =
|
||||
prv_get_ellipsis_border(y, radius_inner_y_sq, radius_inner_x_sq).raw_value;
|
||||
|
@ -1018,7 +1018,7 @@ static void prv_fill_oval_precise(GContext *ctx, GPointPrecise center,
|
|||
int16_t right = center.x.raw_value + outer_edge;
|
||||
|
||||
// If theres circle in the middle - calculate it:
|
||||
if (!no_innner_ellipsis && i < radius_inner_y.integer) {
|
||||
if (!no_inner_ellipsis && i < radius_inner_y.integer) {
|
||||
int16_t inner_edge =
|
||||
prv_get_ellipsis_border(y, radius_inner_y_sq, radius_inner_x_sq).raw_value;
|
||||
|
||||
|
@ -1211,7 +1211,7 @@ MOCKABLE void graphics_draw_arc_precise_internal(GContext *ctx, GPointPrecise ce
|
|||
center.x.raw_value -= center.x.raw_value % (FIXED_S16_3_ONE.raw_value / 2);
|
||||
center.y.raw_value -= center.y.raw_value % (FIXED_S16_3_ONE.raw_value / 2);
|
||||
|
||||
// To maintain compability we have to adjust from integral points where given point means
|
||||
// To maintain compatibility we have to adjust from integral points where given point means
|
||||
// center of the point
|
||||
center.x.raw_value += 4;
|
||||
center.y.raw_value += 4;
|
||||
|
|
|
@ -380,7 +380,7 @@ static bool prv_calc_far_points(GPointPrecise *p0, GPointPrecise *p1, Fixed_S16_
|
|||
}
|
||||
|
||||
// Since we already rotated the vector by 90 degrees, delta x is actually delta y
|
||||
// therefore if x is bigger than y we have have vertical dominance
|
||||
// therefore if x is bigger than y we have vertical dominance
|
||||
if (ABS(dx_fixed) > ABS(dy_fixed)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -411,13 +411,13 @@ void prv_draw_stroked_line_precise(GContext* ctx, GPointPrecise p0, GPointPrecis
|
|||
|
||||
ctx->draw_state.fill_color = ctx->draw_state.stroke_color;
|
||||
|
||||
// If so, draw a circle with corrseponding radius
|
||||
// If so, draw a circle with corresponding radius
|
||||
graphics_fill_circle(ctx, GPoint(p0.x.integer, p0.y.integer), radius.integer);
|
||||
|
||||
// Finish color hack
|
||||
ctx->draw_state.fill_color = temp_color;
|
||||
|
||||
// Return without drawing the line since its not neccessary
|
||||
// Return without drawing the line since its not necessary
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -459,7 +459,7 @@ void prv_draw_stroked_line_precise(GContext* ctx, GPointPrecise p0, GPointPrecis
|
|||
|
||||
// Drawing loop: Iterates over horizontal lines
|
||||
// As part of optimisation, this algorithm is moving between drawing boundaries,
|
||||
// so drawing box has to be substracted from its clipping extremes
|
||||
// so drawing box has to be subtracted from its clipping extremes
|
||||
const int16_t clip_min_y = ctx->draw_state.clip_box.origin.y
|
||||
- ctx->draw_state.drawing_box.origin.y;
|
||||
const int16_t clip_max_y = clip_min_y + ctx->draw_state.clip_box.size.h;
|
||||
|
@ -517,7 +517,7 @@ void prv_draw_stroked_line_precise(GContext* ctx, GPointPrecise p0, GPointPrecis
|
|||
Fixed_S16_3 left_margin = {.raw_value = INT16_MAX};
|
||||
Fixed_S16_3 right_margin = {.raw_value = INT16_MIN};
|
||||
|
||||
// Find edges of the line's straigth part
|
||||
// Find edges of the line's straight part
|
||||
if (y >= far_top.y.integer && y <= far_bottom.y.integer) {
|
||||
// TODO: possible performance optimization: PBL-14744
|
||||
// TODO: ^^ also possible avoid of following logic to avoid division by zero
|
||||
|
@ -585,7 +585,7 @@ void prv_draw_stroked_line_precise(GContext* ctx, GPointPrecise p0, GPointPrecis
|
|||
|
||||
// Drawing loop: Iterates over vertical lines from left to right
|
||||
// As part of optimisation, this algorithm is moving between drawing boundaries,
|
||||
// so drawing box has to be substracted from its clipping extremes
|
||||
// so drawing box has to be subtracted from its clipping extremes
|
||||
const int16_t clip_min_x = ctx->draw_state.clip_box.origin.x
|
||||
- ctx->draw_state.drawing_box.origin.x;
|
||||
const int16_t clip_max_x = clip_min_x + ctx->draw_state.clip_box.size.w;
|
||||
|
@ -645,7 +645,7 @@ void prv_draw_stroked_line_precise(GContext* ctx, GPointPrecise p0, GPointPrecis
|
|||
Fixed_S16_3 top_margin = {.raw_value = INT16_MAX};
|
||||
Fixed_S16_3 bottom_margin = {.raw_value = INT16_MIN};
|
||||
|
||||
// Find edges of the line's straigth part
|
||||
// Find edges of the line's straight part
|
||||
if (x >= far_left.x.integer && x <= far_right.x.integer) {
|
||||
// Main part of the stroked line
|
||||
if (tm_p1.x.raw_value != tm_p0.x.raw_value) {
|
||||
|
@ -774,7 +774,7 @@ void graphics_draw_line(GContext* ctx, GPoint p0, GPoint p1) {
|
|||
graphics_line_draw_stroked_aa(ctx, p0, p1, ctx->draw_state.stroke_width);
|
||||
return;
|
||||
} else {
|
||||
// Antialiased and Stroke Width == 1 (not suppported on 1-bit color)
|
||||
// Antialiased and Stroke Width == 1 (not supported on 1-bit color)
|
||||
graphics_line_draw_1px_aa(ctx, p0, p1);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -191,7 +191,7 @@ void graphics_private_draw_horizontal_line_prepared(GContext *ctx, GBitmap *fram
|
|||
|
||||
void graphics_private_draw_horizontal_line_integral(GContext *ctx, GBitmap *framebuffer, int16_t y,
|
||||
int16_t x1, int16_t x2, GColor color) {
|
||||
// This is a wrapper for prv_draw_horizontal_line_raw for integral coordintaes
|
||||
// This is a wrapper for prv_draw_horizontal_line_raw for integral coordinates
|
||||
|
||||
// End of the line is inclusive so we subtract one
|
||||
x2--;
|
||||
|
|
|
@ -188,7 +188,7 @@ T_STATIC void prv_assign_vertical_line_raw(GContext *ctx, int16_t x, Fixed_S16_3
|
|||
}
|
||||
|
||||
// This function draws horizontal line with blending, given values have to be clipped and adjusted
|
||||
// clip_box and draw_box respecively.
|
||||
// clip_box and draw_box respectively.
|
||||
T_STATIC void prv_blend_horizontal_line_raw(GContext *ctx, int16_t y, int16_t x1, int16_t x2,
|
||||
GColor color) {
|
||||
PBL_ASSERTN(ctx);
|
||||
|
@ -212,7 +212,7 @@ T_STATIC void prv_blend_horizontal_line_raw(GContext *ctx, int16_t y, int16_t x1
|
|||
}
|
||||
|
||||
// This function draws vertical line with blending, given values have to be clipped and adjusted
|
||||
// clip_box and draw_box respecively.
|
||||
// clip_box and draw_box respectively.
|
||||
T_STATIC void prv_blend_vertical_line_raw(GContext *ctx, int16_t x, int16_t y1, int16_t y2,
|
||||
GColor color) {
|
||||
PBL_ASSERTN(ctx);
|
||||
|
|
|
@ -114,7 +114,7 @@ bool gtransform_is_equal(const GTransform * const t1, const GTransform * const t
|
|||
//////////////////////////////////////
|
||||
/// Modifying Transforms
|
||||
//////////////////////////////////////
|
||||
// Note that t_new can be set to either of t1 or t2 safely to do in place muliplication
|
||||
// Note that t_new can be set to either of t1 or t2 safely to do in place multiplication
|
||||
// Note this operation is not commutative. The operation is as follows t_new = t1 * t2
|
||||
void gtransform_concat(GTransform *t_new, const GTransform *t1, const GTransform * t2) {
|
||||
if ((!t_new) || (!t1) || (!t2)) {
|
||||
|
|
|
@ -171,7 +171,7 @@ bool gtransform_is_equal(const GTransform * const t1, const GTransform * const t
|
|||
//////////////////////////////////////
|
||||
//! Concatenates two transformation matrices and returns the resulting matrix in t1
|
||||
//! The operation performed is t_new = t1*t2. This order is not commutative so be careful
|
||||
//! when contactenating the matrices.
|
||||
//! when concatenating the matrices.
|
||||
//! Note t_new can safely be be the same pointer as t1 or t2.
|
||||
//! @param t_new Pointer to destination transformation matrix
|
||||
//! @param t1 Pointer to transformation matrix to concatenate with t2 where t_new = t1*t2
|
||||
|
|
|
@ -350,7 +350,7 @@ void gpoint_sort(GPoint *points, size_t num_points, GPointComparator comparator,
|
|||
#define GPOINT_PRECISE_PRECISION FIXED_S16_3_PRECISION
|
||||
#define GPOINT_PRECISE_FACTOR FIXED_S16_3_FACTOR
|
||||
|
||||
//! Internal respresentation of a point
|
||||
//! Internal representation of a point
|
||||
//! 1 bit for sign, 12 bits represent the coordinate, 3 bits represent the precision
|
||||
//! Supports -4096.000 px to 4095.875 px resolution
|
||||
typedef struct __attribute__ ((__packed__)) GPointPrecise {
|
||||
|
@ -673,7 +673,7 @@ typedef struct {
|
|||
#define GEdgeInsets(...) \
|
||||
GEdgeInsetsN(__VA_ARGS__, GEdgeInsets4, GEdgeInsets3, GEdgeInsets2, GEdgeInsets1)(__VA_ARGS__)
|
||||
|
||||
//! Returns a rectangle that is shrinked or expanded by the given edge insets.
|
||||
//! Returns a rectangle that is shrunk or expanded by the given edge insets.
|
||||
//! @note The rectangle is standardized and then the inset parameters are applied.
|
||||
//! If the resulting rectangle would have a negative height or width, a GRectZero is returned.
|
||||
//! @param rect The rectangle that will be inset
|
||||
|
@ -1065,7 +1065,7 @@ GBitmap *gbitmap_create_with_resource_system(ResAppNum app_num, uint32_t resourc
|
|||
//! @internal
|
||||
//! @see gbitmap_init_with_resource
|
||||
//! @param app_num The app's resource bank number
|
||||
//! @return true if we were sucessful, false otherwise
|
||||
//! @return true if we were successful, false otherwise
|
||||
bool gbitmap_init_with_resource_system(GBitmap* bitmap, ResAppNum app_num, uint32_t resource_id);
|
||||
|
||||
//! @internal
|
||||
|
@ -1352,7 +1352,7 @@ typedef struct PACKED {
|
|||
typedef Fixed_S32_16 GTransformNumber;
|
||||
|
||||
//! @internal
|
||||
//! Data structure that contains the internal representation of a 3x3 tranformation matrix
|
||||
//! Data structure that contains the internal representation of a 3x3 transformation matrix
|
||||
//! The transformation matrix will be expressed as follows:
|
||||
//! [ a b 0 ]
|
||||
//! [ c d 0 ]
|
||||
|
|
|
@ -53,7 +53,7 @@ typedef enum {
|
|||
GTextOverflowModeFill
|
||||
} GTextOverflowMode;
|
||||
|
||||
//! Text aligment controls the way the text is aligned inside the box the text is drawn into.
|
||||
//! Text alignment controls the way the text is aligned inside the box the text is drawn into.
|
||||
//! @see graphics_draw_text
|
||||
//! @see text_layer_set_text_alignment
|
||||
typedef enum {
|
||||
|
@ -138,7 +138,7 @@ void graphics_text_init(void);
|
|||
|
||||
//! Draw text into the current graphics context, using the context's current text color.
|
||||
//! The text will be drawn inside a box with the specified dimensions and
|
||||
//! configuration, with clipping occuring automatically.
|
||||
//! configuration, with clipping occurring automatically.
|
||||
//! @param ctx The destination graphics context in which to draw
|
||||
//! @param text The zero terminated UTF-8 string to draw
|
||||
//! @param font The font in which the text should be set
|
||||
|
|
|
@ -267,7 +267,7 @@ static bool prv_line_iter_is_vertical_overflow(const LineIterState* const line_i
|
|||
// if we're not rendering the first line.
|
||||
// - This, because the user does not expect to see more text drawn below, after the '...'.
|
||||
// - The first-line exception means that text, and therefore the telltale
|
||||
// ellipsis, will always be visisble.
|
||||
// ellipsis, will always be visible.
|
||||
if ((text_box_params->overflow_mode == GTextOverflowModeTrailingEllipsis ||
|
||||
text_box_params->overflow_mode == GTextOverflowModeFill) &&
|
||||
line_iter_state->current->origin.y != text_box_params->box.origin.y) {
|
||||
|
@ -791,11 +791,11 @@ static inline void prv_walk_lines_down(Iterator* const line_iter, TextLayout* co
|
|||
const Word word_before_rendering = *current_word_ref;
|
||||
const OrphanLineState orphan_state = prv_capture_orphan_state(line);
|
||||
|
||||
// When repeating text to prevent orhpans we could run into the situation where repeating text
|
||||
// When repeating text to prevent orphans we could run into the situation where repeating text
|
||||
// pushes down the remaining text far enough so it ends up on yet another page. This would
|
||||
// enter an infinite loop.
|
||||
// To avoid that, we only apply this strategy, when it's "safe" to do so (in theory, there's
|
||||
// still the propability to run into this scenario if the perimeter isn't vertically symmetric).
|
||||
// still the probability to run into this scenario if the perimeter isn't vertically symmetric).
|
||||
// The chosen number should be large enough for the previous line, the orphan line plus some
|
||||
// buffer.
|
||||
const int num_safe_lines = 3;
|
||||
|
@ -823,7 +823,7 @@ render_line: {} // this {} is just an empty statement that both C and our linter
|
|||
if (is_orphan) {
|
||||
*current_word_ref = prev_line_word;
|
||||
prv_apply_orphan_state(&orphan_state, line);
|
||||
avoiding_orphans = false; // prevent infinte loops
|
||||
avoiding_orphans = false; // prevent infinite loops
|
||||
goto render_line;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,9 +130,9 @@ void render_glyph(GContext* const ctx, const uint32_t codepoint, FontInfo* const
|
|||
|
||||
// The number of bits between the beginning of dest_block and glyph_block.
|
||||
// If x is negative we need to be fancy to get the rounded down remainder. This
|
||||
// is the number of bits to the right of the next 32-bit boundry to the left.
|
||||
// is the number of bits to the right of the next 32-bit boundary to the left.
|
||||
// For example, if x is -5 we want this shift to be 27, since -32 (the nearest
|
||||
// boundry) + 27 = -5
|
||||
// boundary) + 27 = -5
|
||||
const uint8_t dest_shift_at_line_begin = (x >= 0) ?
|
||||
x % 32 :
|
||||
(x - ((x / 32) * 32));
|
||||
|
|
|
@ -225,7 +225,7 @@ static GlyphData *prv_decompress_glyph_data(GlyphData *g, uint8_t *src) {
|
|||
// *src is a pointer to the beginning of <encoded glyph>
|
||||
//
|
||||
// Once decompressed, Glyph Data will be formatted like this:
|
||||
// [ <header> | <decoded glyph> | <free space & remenants of encoded glyph data> ]
|
||||
// [ <header> | <decoded glyph> | <free space & remnants of encoded glyph data> ]
|
||||
//
|
||||
// The glyph is decoded in-place, so obviously, it's imperative that <decoded glyph> and
|
||||
// <encoded glyph> not overlap at any time. This is checked by fontgen.py and confirmed
|
||||
|
|
|
@ -328,7 +328,7 @@ HealthServiceAccessibilityMask health_service_metric_accessible(
|
|||
//! @param time_start Earliest UTC time you are interested in.
|
||||
//! @param time_end Latest UTC time you are interested in.
|
||||
//! @param scope \ref HealthServiceTimeScope value describing how the average should be computed.
|
||||
//! @return A \HealthServiceAccessibilityMask value decribing whether averaged data is available.
|
||||
//! @return A \HealthServiceAccessibilityMask value describing whether averaged data is available.
|
||||
HealthServiceAccessibilityMask health_service_metric_averaged_accessible(
|
||||
HealthMetric metric, time_t time_start, time_t time_end, HealthServiceTimeScope scope);
|
||||
|
||||
|
@ -342,7 +342,7 @@ HealthServiceAccessibilityMask health_service_metric_averaged_accessible(
|
|||
//! @param time_end Latest UTC time you are interested in.
|
||||
//! @param aggregation The aggregation to perform
|
||||
//! @param scope \ref HealthServiceTimeScope value describing how the average should be computed.
|
||||
//! @return A \HealthServiceAccessibilityMask value decribing whether averaged data is available.
|
||||
//! @return A \HealthServiceAccessibilityMask value describing whether averaged data is available.
|
||||
HealthServiceAccessibilityMask health_service_metric_aggregate_averaged_accessible(
|
||||
HealthMetric metric, time_t time_start, time_t time_end, HealthAggregation aggregation,
|
||||
HealthServiceTimeScope scope);
|
||||
|
@ -379,7 +379,7 @@ typedef enum {
|
|||
|
||||
//! Developer-supplied event handler, called when a health-related event occurs after subscribing
|
||||
//! via \ref health_service_events_subscribe();
|
||||
//! @param event The type of health-related event that occured.
|
||||
//! @param event The type of health-related event that occurred.
|
||||
//! @param context The developer-supplied context pointer.
|
||||
typedef void (*HealthEventHandler)(HealthEventType event, void *context);
|
||||
|
||||
|
@ -443,7 +443,7 @@ uint16_t health_service_get_heart_rate_sample_period_expiration_sec(void);
|
|||
//! \endcode
|
||||
//!
|
||||
//! In the current implementation, only one alert per metric can be registered at a time. Future
|
||||
//! implementations may support two or more simulataneous alert registrations per metric. To change
|
||||
//! implementations may support two or more simultaneous alert registrations per metric. To change
|
||||
//! the alert threshold in the current implementation, cancel the original registration
|
||||
//! using `health_service_cancel_metric_alert` before registering the new threshold.
|
||||
//! @param metric Which \ref HealthMetric to query.
|
||||
|
@ -490,7 +490,7 @@ typedef struct {
|
|||
//! exit, the UTC time of the end of the last record actually returned (i.e. start time of last
|
||||
//! record + 60). If `time_end` on entry is somewhere in the middle of a minute interval, this
|
||||
//! function behaves as if the caller passed in the end of that minute.
|
||||
//! @return Actual number of records returned. May be less then the maximum requested.
|
||||
//! @return Actual number of records returned. May be less than the maximum requested.
|
||||
//! @note If the return value is zero, `time_start` and `time_end` are meaningless.
|
||||
//! It's not guaranteed that all records contain valid data, even if the return value is
|
||||
//! greater than zero. Check `HealthMinuteData.is_invalid` to see if a given record contains
|
||||
|
|
|
@ -136,7 +136,7 @@ typedef struct ActionBarLayerLegacy2 {
|
|||
//! @param action_bar The action bar to initialize
|
||||
void action_bar_layer_legacy2_init(ActionBarLayerLegacy2 *action_bar);
|
||||
|
||||
//! Creates a new ActionBarLayerLegacy2 on the heap and initalizes it with the default values.
|
||||
//! Creates a new ActionBarLayerLegacy2 on the heap and initializes it with the default values.
|
||||
//! * Background color: \ref GColorBlack
|
||||
//! * No click configuration provider (`NULL`)
|
||||
//! * No icons
|
||||
|
@ -220,7 +220,7 @@ void action_bar_layer_legacy2_clear_icon(ActionBarLayerLegacy2 *action_bar, Butt
|
|||
//! @note It is advised to call this is in the window's `.load` or `.appear`
|
||||
//! handler. Make sure to call \ref action_bar_layer_legacy2_remove_from_window() in the
|
||||
//! window's `.unload` or `.disappear` handler.
|
||||
//! @note Adding additional layers to the window's root layer after this calll
|
||||
//! @note Adding additional layers to the window's root layer after this call
|
||||
//! can occlude the action bar.
|
||||
//! @param action_bar The action bar to associate with the window
|
||||
//! @param window The window with which the action bar is to be associated
|
||||
|
|
|
@ -45,7 +45,7 @@ struct AnimationLegacy2Implementation;
|
|||
struct AnimationLegacy2Handlers;
|
||||
|
||||
|
||||
//! Creates a new AnimationLegacy2 on the heap and initalizes it with the default values.
|
||||
//! Creates a new AnimationLegacy2 on the heap and initializes it with the default values.
|
||||
//!
|
||||
//! * Duration: 250ms,
|
||||
//! * Curve: \ref AnimationCurveEaseInOut (ease-in-out),
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
//! Actually, property animations do more than just moving a Layer around over time.
|
||||
//! PropertyAnimationLegacy2 is a concrete class of animations and is built around the Animation
|
||||
//! subsystem, which covers anything timing related, but does not move anything around.
|
||||
//! A ProperyAnimation animates a "property" of a "subject".
|
||||
//! A PropertyAnimation animates a "property" of a "subject".
|
||||
//!
|
||||
//! <h3>Animating a Layer's frame property</h3>
|
||||
//! Currently there is only one specific type of property animation offered off-the-shelf, namely
|
||||
|
@ -68,7 +68,7 @@
|
|||
//! __type__ value);`
|
||||
//! See \ref Int16Getter, \ref Int16Setter, \ref GPointGetter, \ref GPointSetter, \ref GRectGetter,
|
||||
//! \ref GRectSetter
|
||||
//! for the typedefs that accompany the update fuctions.
|
||||
//! for the typedefs that accompany the update functions.
|
||||
//!
|
||||
//! \code{.c}
|
||||
//! static const PropertyAnimationLegacy2Implementation my_implementation = {
|
||||
|
@ -127,7 +127,7 @@ void property_animation_legacy2_init(struct PropertyAnimationLegacy2 *property_a
|
|||
const struct PropertyAnimationLegacy2Implementation *implementation, void *subject,
|
||||
void *from_value, void *to_value);
|
||||
|
||||
//! Creates a new PropertyAnimationLegacy2 on the heap and and initializes it with the specified
|
||||
//! Creates a new PropertyAnimationLegacy2 on the heap and initializes it with the specified
|
||||
//! values. The same defaults are used as with \ref animation_create().
|
||||
//! If the `from_value` or the `to_value` is `NULL`, the getter accessor will be called to get the
|
||||
//! current value of the property and be used instead.
|
||||
|
|
|
@ -71,7 +71,7 @@ typedef struct TextLayerLegacy2 {
|
|||
//!
|
||||
//! The text layer is automatically marked dirty after this operation.
|
||||
//! @param text_layer The TextLayerLegacy2 to initialize
|
||||
//! @param frame The frame with which to initialze the TextLayerLegacy2
|
||||
//! @param frame The frame with which to initialize the TextLayerLegacy2
|
||||
void text_layer_legacy2_init(TextLayerLegacy2 *text_layer, const GRect *frame);
|
||||
|
||||
//! Creates a new TextLayerLegacy2 on the heap and initializes it with the default values.
|
||||
|
@ -85,7 +85,7 @@ void text_layer_legacy2_init(TextLayerLegacy2 *text_layer, const GRect *frame);
|
|||
//! * Caching: `false`
|
||||
//!
|
||||
//! The text layer is automatically marked dirty after this operation.
|
||||
//! @param frame The frame with which to initialze the TextLayerLegacy2
|
||||
//! @param frame The frame with which to initialize the TextLayerLegacy2
|
||||
//! @return A pointer to the TextLayerLegacy2. `NULL` if the TextLayerLegacy2 could not
|
||||
//! be created
|
||||
TextLayerLegacy2* text_layer_legacy2_create(GRect frame);
|
||||
|
@ -161,7 +161,7 @@ void text_layer_legacy2_set_text_alignment(TextLayerLegacy2 *text_layer,
|
|||
//! By default, layout caching is off (false). Layout caches store the max used
|
||||
//! height and width of a text layer.
|
||||
//! NOTE: when using cached layouts, text_layer_legacy2_deinit() MUST be called at some
|
||||
//! point in time to prevent memory leaks from occuring.
|
||||
//! point in time to prevent memory leaks from occurring.
|
||||
void text_layer_legacy2_set_should_cache_layout(TextLayerLegacy2 *text_layer,
|
||||
bool should_cache_layout);
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ static uint16_t prv_get_service_index(Uuid *uuid) {
|
|||
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------
|
||||
// Used by list_find to locate the handler for a specfic service index.
|
||||
// Used by list_find to locate the handler for a specific service index.
|
||||
static bool prv_service_filter(ListNode *node, void *tp) {
|
||||
PluginServiceEntry *info = (PluginServiceEntry *)node;
|
||||
uint16_t service_idx = (uint16_t)(uintptr_t)tp;
|
||||
|
|
|
@ -32,7 +32,7 @@ typedef struct {
|
|||
typedef struct __attribute__((packed)) PluginServiceState {
|
||||
bool subscribed_to_app_event_service : 1; // Set on first plugin_service_subscribe by this app
|
||||
EventServiceInfo event_service_info;
|
||||
ListNode subscribed_services; // Linked list of PluginServiceEntrys
|
||||
ListNode subscribed_services; // Linked list of PluginServiceEntry
|
||||
} PluginServiceState;
|
||||
|
||||
void plugin_service_state_init(PluginServiceState *state);
|
||||
|
|
|
@ -73,7 +73,7 @@ typedef struct {
|
|||
typedef struct OutgoingObject {
|
||||
ListNode node;
|
||||
|
||||
//! Working buffer containing the JSON string respresentation of the object.
|
||||
//! Working buffer containing the JSON string representation of the object.
|
||||
char *data_buffer;
|
||||
|
||||
//! The next offset in bytes, into the JSON string (excluding the PostMessageChunkPayload
|
||||
|
|
|
@ -67,7 +67,7 @@ static bool prv_matches_system_locale(jerry_value_t locale) {
|
|||
return true;
|
||||
}
|
||||
|
||||
// in the future, we could run a case-insenstive compare against app_get_system_locale()
|
||||
// in the future, we could run a case-insensitive compare against app_get_system_locale()
|
||||
// but as we want apps to encourage to be i18n, there's no real point to
|
||||
// receive strings such as 'en-us'. We will ask them to always pass undefined instead
|
||||
return false;
|
||||
|
|
|
@ -188,7 +188,7 @@ T_STATIC const RockyAPIGraphicsColorDefinition s_color_definitions[] = {
|
|||
{"transparent", GColorClearARGB8},
|
||||
{"clear", GColorClearARGB8},
|
||||
|
||||
// Pebble colors taken from gcolor_defitions.h
|
||||
// Pebble colors taken from gcolor_definitions.h
|
||||
{"black", GColorBlackARGB8},
|
||||
{"oxfordblue", GColorOxfordBlueARGB8},
|
||||
{"dukeblue", GColorDukeBlueARGB8},
|
||||
|
|
|
@ -58,7 +58,7 @@ static bool prv_is_headroom_allocated(const RockyMemoryAPIContext *ctx) {
|
|||
}
|
||||
|
||||
static void prv_allocate_headroom_or_die(RockyMemoryAPIContext *ctx) {
|
||||
// It's highly likely that while executing a the handler for the 'memorypressure' event,
|
||||
// It's highly likely that while executing the handler for the 'memorypressure' event,
|
||||
// new objects have been created on the heap. Therefore, it's unlikely we'll be able to reclaim
|
||||
// the desired headroom immediately after returning from the handler. Try to grab as much as we
|
||||
// can and resize it later on, see prv_resize_headroom_if_needed().
|
||||
|
@ -153,7 +153,7 @@ static void prv_memory_callback(jmem_free_unused_memory_severity_t severity,
|
|||
return;
|
||||
}
|
||||
|
||||
// Trigger agressive garbage collection, force property hashmaps to be dropped:
|
||||
// Trigger aggressive garbage collection, force property hashmaps to be dropped:
|
||||
prv_collect_all_garbage();
|
||||
jmem_heap_stats_t stats = {};
|
||||
jmem_heap_get_stats(&stats);
|
||||
|
|
|
@ -101,5 +101,5 @@ static bool prv_add_handler(const char *event_name, jerry_value_t handler) {
|
|||
const RockyGlobalAPI TICKSERVICE_APIS = {
|
||||
.init = prv_init,
|
||||
.add_handler = prv_add_handler,
|
||||
// TODO: PBL-43380 apparently, we never unsubsrcibed from tick events…
|
||||
// TODO: PBL-43380 apparently, we never unsubscribed from tick events…
|
||||
};
|
||||
|
|
|
@ -155,7 +155,7 @@ typedef struct {
|
|||
//! @param action_bar The action bar to initialize
|
||||
void action_bar_layer_init(ActionBarLayer *action_bar);
|
||||
|
||||
//! Creates a new ActionBarLayer on the heap and initalizes it with the default values.
|
||||
//! Creates a new ActionBarLayer on the heap and initializes it with the default values.
|
||||
//! * Background color: \ref GColorBlack
|
||||
//! * No click configuration provider (`NULL`)
|
||||
//! * No icons
|
||||
|
@ -265,7 +265,7 @@ void action_bar_layer_clear_icon(ActionBarLayer *action_bar, ButtonId button_id)
|
|||
//! @note It is advised to call this is in the window's `.load` or `.appear`
|
||||
//! handler. Make sure to call \ref action_bar_layer_remove_from_window() in the
|
||||
//! window's `.unload` or `.disappear` handler.
|
||||
//! @note Adding additional layers to the window's root layer after this calll
|
||||
//! @note Adding additional layers to the window's root layer after this call
|
||||
//! can occlude the action bar.
|
||||
//! @param action_bar The action bar to associate with the window
|
||||
//! @param window The window with which the action bar is to be associated
|
||||
|
|
|
@ -589,7 +589,7 @@ static void prv_draw_separator_cb(GContext *ctx, const Layer *cell_layer,
|
|||
system_theme_get_default_content_size_for_runtime_platform();
|
||||
const ActionMenuSeparatorConfig *config = &s_separator_configs[runtime_platform_default_size];
|
||||
|
||||
// If this index is the seperator index, we want to draw the separator line
|
||||
// If this index is the separator index, we want to draw the separator line
|
||||
// in the vertical center of the separator
|
||||
const int16_t nudge_down = PBL_IF_RECT_ELSE(3, 0);
|
||||
const int16_t nudge_right = menu_cell_basic_horizontal_inset() + 1;
|
||||
|
|
|
@ -68,7 +68,7 @@ typedef void (*ActionMenuWillCloseCb)(ActionMenu *menu,
|
|||
//! Configuration struct for the ActionMenu
|
||||
typedef struct {
|
||||
const ActionMenuLevel *root_level; //!< the root level of the ActionMenu
|
||||
void *context; //!< a context pointer which will be accessbile when actions are performed
|
||||
void *context; //!< a context pointer which will be accessible when actions are performed
|
||||
struct {
|
||||
GColor background; //!< the color of the left column of the ActionMenu
|
||||
GColor foreground; //!< the color of the individual "crumbs" that indicate menu depth
|
||||
|
|
|
@ -110,7 +110,7 @@ typedef enum {
|
|||
} AnimationCurve;
|
||||
|
||||
|
||||
//! Creates a new Animation on the heap and initalizes it with the default values.
|
||||
//! Creates a new Animation on the heap and initializes it with the default values.
|
||||
//!
|
||||
//! * Duration: 250ms,
|
||||
//! * Curve: \ref AnimationCurveEaseInOut (ease-in-out),
|
||||
|
|
|
@ -48,7 +48,7 @@ int64_t interpolate_int64_linear(int32_t normalized, int64_t from, int64_t to);
|
|||
|
||||
//! Interpolation between two int64_t.
|
||||
//! In most cases, this is a linear interpolation but the behavior can vary if this function
|
||||
//! is called from within an animation's update handdler that uses
|
||||
//! is called from within an animation's update handler that uses
|
||||
//! AnimationCurveCustomInterpolationFunction. This allows clients to transparently implement
|
||||
//! effects such as spatial easing. See \ref animation_set_custom_interpolation().
|
||||
int64_t interpolate_int64(int32_t normalized, int64_t from, int64_t to);
|
||||
|
@ -111,7 +111,7 @@ int64_t interpolate_moook_in_only(int32_t normalized, int64_t from, int64_t to);
|
|||
//! @param from Starting point in space of the animation
|
||||
//! @param to Ending point in space of the animation
|
||||
//! @param bounce_back Whether to lead up to the end point from the opposite direction if we were
|
||||
//! to lead up from the start poing, which a normal Moook curve would do.
|
||||
//! to lead up from the start point, which a normal Moook curve would do.
|
||||
int64_t interpolate_moook_out(int32_t normalized, int64_t from, int64_t to,
|
||||
int32_t num_frames_from, bool bounce_back);
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ void bitmap_layer_update_proc(BitmapLayer *image, GContext* ctx) {
|
|||
if (!process_manager_compiled_with_legacy2_sdk()) {
|
||||
// Dirty workaround for calculation of offset in graphics_draw_bitmap_in_rect
|
||||
// and preserving state of bitmap alignment in bitmap_layer
|
||||
// The previous behavior is relied on by some 2.x apps, and therefore we exlude
|
||||
// The previous behavior is relied on by some 2.x apps, and therefore we exclude
|
||||
// the fix for apps compiled with older SDKs. See PBL-19136 for details.
|
||||
rect.origin.x -= image->layer.bounds.origin.x;
|
||||
rect.origin.y -= image->layer.bounds.origin.y;
|
||||
|
|
|
@ -75,10 +75,10 @@ typedef struct BitmapLayer {
|
|||
//!
|
||||
//! The bitmap layer is automatically marked dirty after this operation.
|
||||
//! @param bitmap_layer The BitmapLayer to initialize
|
||||
//! @param frame The frame with which to initialze the BitmapLayer
|
||||
//! @param frame The frame with which to initialize the BitmapLayer
|
||||
void bitmap_layer_init(BitmapLayer *bitmap_layer, const GRect *frame);
|
||||
|
||||
//! Creates a new bitmap layer on the heap and initalizes it the default values.
|
||||
//! Creates a new bitmap layer on the heap and initializes it the default values.
|
||||
//!
|
||||
//! * Bitmap: `NULL` (none)
|
||||
//! * Background color: \ref GColorClear
|
||||
|
@ -120,13 +120,13 @@ const GBitmap* bitmap_layer_get_bitmap(BitmapLayer *bitmap_layer);
|
|||
void bitmap_layer_set_bitmap(BitmapLayer *bitmap_layer, const GBitmap *bitmap);
|
||||
|
||||
//! Sets the alignment of the image to draw with in frame of the BitmapLayer.
|
||||
//! The aligment parameter specifies which edges of the bitmap should overlap
|
||||
//! The alignment parameter specifies which edges of the bitmap should overlap
|
||||
//! with the frame of the BitmapLayer.
|
||||
//! If the bitmap is smaller than the frame of the BitmapLayer, the background
|
||||
//! is filled with the background color.
|
||||
//!
|
||||
//! The bitmap layer is automatically marked dirty after this operation.
|
||||
//! @param bitmap_layer The BitmapLayer for which to set the aligment
|
||||
//! @param bitmap_layer The BitmapLayer for which to set the alignment
|
||||
//! @param alignment The new alignment for the image inside the BitmapLayer
|
||||
void bitmap_layer_set_alignment(BitmapLayer *bitmap_layer, GAlign alignment);
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ template to the app's ClickRecognizers.
|
|||
|
||||
<p/>
|
||||
|
||||
Whenever a the head of the window stack changes, the OS is responsible
|
||||
Whenever the head of the window stack changes, the OS is responsible
|
||||
for ensuring that all of its registered click recognizers are reset
|
||||
and reconfigured using the new visible window's
|
||||
ClickConfigProvider. This happens in the window_stack_private_push &
|
||||
|
|
|
@ -41,7 +41,7 @@ void actionable_dialog_init(ActionableDialog *actionable_dialog, const char *dia
|
|||
Dialog *actionable_dialog_get_dialog(ActionableDialog *actionable_dialog);
|
||||
|
||||
//! Sets the type of action bar to used to one of the pre-defined types or a custom one.
|
||||
//! @param actionable_dialog Pointer to a \ref ActioanbleDialog whom which to set
|
||||
//! @param actionable_dialog Pointer to a \ref ActionableDialog whom which to set
|
||||
//! @param action_bar_type The type of action bar to give the passed dialog
|
||||
//! @param action_bar Pointer to an \ref ActionBarLayer to assign to the dialog
|
||||
//! @note: The pointer to an \ref ActionBarLayer is optional and only required when the
|
||||
|
@ -53,7 +53,7 @@ void actionable_dialog_set_action_bar_type(ActionableDialog *actionable_dialog,
|
|||
ActionBarLayer *action_bar);
|
||||
|
||||
//! Sets the ClickConfigProvider of the action bar. If the dialog has a custom action bar then
|
||||
//! this function has no effect. The action bar is responsible for setting up it's own click
|
||||
//! this function has no effect. The action bar is responsible for setting up its own click
|
||||
//! config provider
|
||||
//! @param actionable_dialog Pointer to a \ref ActionableDialog to which to set the provider on
|
||||
//! @param click_config_provider The \ref ClickConfigProvider to set
|
||||
|
|
|
@ -78,7 +78,7 @@ ExpandableDialog *expandable_dialog_create_with_params(const char *dialog_name,
|
|||
//! Simple callback which closes the dialog when called
|
||||
void expandable_dialog_close_cb(ClickRecognizerRef recognizer, void *e_dialog);
|
||||
|
||||
//! Intializes an ExpandableDialog
|
||||
//! Initializes an ExpandableDialog
|
||||
//! @param expandable_dialog Pointer to an \ref ExpandableDialog
|
||||
//! param dialog_name The name to give the \ref ExpandableDialog
|
||||
void expandable_dialog_init(ExpandableDialog *expandable_dialog, const char *dialog_name);
|
||||
|
@ -88,7 +88,7 @@ void expandable_dialog_init(ExpandableDialog *expandable_dialog, const char *dia
|
|||
//! @return \ref Dialog
|
||||
Dialog *expandable_dialog_get_dialog(ExpandableDialog *expandable_dialog);
|
||||
|
||||
//! Sets whether or not the expandable dialog should should show its action bar.
|
||||
//! Sets whether or not the expandable dialog should show its action bar.
|
||||
//! @param expandable_dialog Pointer to the \ref ExpandableDialog to set on
|
||||
//! @param show_action_bar Boolean indicating whether to show the action bar
|
||||
void expandable_dialog_show_action_bar(ExpandableDialog *expandable_dialog,
|
||||
|
|
|
@ -164,7 +164,7 @@ static void prv_click_handler(ClickRecognizerRef recognizer, void *context) {
|
|||
}
|
||||
|
||||
static void prv_config_provider(void *context) {
|
||||
// Simple dialogs are dimissed when any button is pushed.
|
||||
// Simple dialogs are dismissed when any button is pushed.
|
||||
window_single_click_subscribe(BUTTON_ID_SELECT, prv_click_handler);
|
||||
window_single_click_subscribe(BUTTON_ID_UP, prv_click_handler);
|
||||
window_single_click_subscribe(BUTTON_ID_DOWN, prv_click_handler);
|
||||
|
|
|
@ -172,7 +172,7 @@ void layer_init(Layer *layer, const GRect *frame);
|
|||
//! be created
|
||||
Layer* layer_create(GRect frame);
|
||||
|
||||
//! Creates a layer on the heap with extra space for callback data, and set its frame andbounds.
|
||||
//! Creates a layer on the heap with extra space for callback data, and set its frame and bounds.
|
||||
//! Default values:
|
||||
//! * `bounds` : origin (0, 0) and a size equal to the frame that is passed in.
|
||||
//! * `clips` : `true`
|
||||
|
|
|
@ -393,7 +393,7 @@ static void prv_menu_layer_walk_downward_from_iterator(MenuIterator *it) {
|
|||
it->cursor.sep = prv_menu_layer_get_separator_height(it->menu_layer, &it->cursor.index);
|
||||
it->cursor.y = it->cell_bottom_y; // Bottom of previous cell is y of the next cell
|
||||
|
||||
// Don't leave space for the seperator for the (non-existent) row after the last row.
|
||||
// Don't leave space for the separator for the (nonexistent) row after the last row.
|
||||
// This doesn't impact cell drawing in this loop (this condition will only trip on the last run).
|
||||
// But, other parts of the system rely on the cursor being set properly at the end of this iteration.
|
||||
if (it->cursor.index.row < num_rows_in_section - 1 || it->cursor.index.section < num_sections - 1) {
|
||||
|
@ -471,7 +471,7 @@ static void prv_menu_layer_walk_upward_from_iterator(MenuIterator *it) {
|
|||
const int16_t total_height = it->cursor.h + it->cursor.sep;
|
||||
if (total_height > it->cursor.y) {
|
||||
// If the total height is greater than the cursor y, don't
|
||||
// add in space to accodomate the separator as the downwards callback
|
||||
// add in space to accommodate the separator as the downwards callback
|
||||
// will add it for us.
|
||||
it->cursor.y -= it->cursor.h;
|
||||
} else {
|
||||
|
@ -1055,7 +1055,7 @@ void prv_center_focus_animation_update_in_and_out(Animation *animation,
|
|||
|
||||
void prv_center_focus_animation_update_out_only(Animation *animation,
|
||||
const AnimationProgress progress) {
|
||||
// anwalys only render the bounce back
|
||||
// anyways only render the bounce back
|
||||
prv_center_focus_animation_update_impl(animation, true, progress);
|
||||
}
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@ typedef void (*MenuLayerDrawSeparatorCallback)(GContext* ctx,
|
|||
|
||||
//! Function signature for the callback to handle the event that a user hits
|
||||
//! the SELECT button.
|
||||
//! @param menu_layer The \ref MenuLayer for which the selection event occured
|
||||
//! @param menu_layer The \ref MenuLayer for which the selection event occurred
|
||||
//! @param cell_index The MenuIndex of the cell that is selected
|
||||
//! @param callback_context The callback context
|
||||
//! @see \ref menu_layer_set_callbacks()
|
||||
|
@ -225,7 +225,7 @@ typedef void (*MenuLayerSelectCallback)(struct MenuLayer *menu_layer,
|
|||
|
||||
//! Function signature for the callback to handle a change in the current
|
||||
//! selected item in the menu.
|
||||
//! @param menu_layer The \ref MenuLayer for which the selection event occured
|
||||
//! @param menu_layer The \ref MenuLayer for which the selection event occurred
|
||||
//! @param new_index The MenuIndex of the new item that is selected now
|
||||
//! @param old_index The MenuIndex of the old item that was selected before
|
||||
//! @param callback_context The callback context
|
||||
|
@ -239,7 +239,7 @@ typedef void (*MenuLayerSelectionChangedCallback)(struct MenuLayer *menu_layer,
|
|||
//! Function signature for the callback which allows or changes selection behavior of the menu.
|
||||
//! In order to change the cell that should be selected, modify the passed in new_index.
|
||||
//! Preventing the selection from changing, new_index can be assigned the value of old_index.
|
||||
//! @param menu_layer The \ref MenuLayer for which the selection event that occured
|
||||
//! @param menu_layer The \ref MenuLayer for which the selection event that occurred
|
||||
//! @param new_index Pointer to the index that the MenuLayer is going to change selection to.
|
||||
//! @param old_index The index that is being unselected.
|
||||
//! @param callback_context The callback context
|
||||
|
@ -374,13 +374,13 @@ typedef struct MenuLayer {
|
|||
MenuCellSpan cursor;
|
||||
} cache;
|
||||
//! @internal
|
||||
//! Selected cell index + geometery cache of the selected cell
|
||||
//! Selected cell index + geometry cache of the selected cell
|
||||
MenuCellSpan selection;
|
||||
MenuLayerCallbacks callbacks;
|
||||
void *callback_context;
|
||||
|
||||
//! Default colors to be used for \ref MenuLayer.
|
||||
//! Use MenuLayerColorNormal and MenuLayerColorHightlight for indexing.
|
||||
//! Use MenuLayerColorNormal and MenuLayerColorHighlight for indexing.
|
||||
GColor normal_colors[MenuLayerColor_Count];
|
||||
GColor highlight_colors[MenuLayerColor_Count];
|
||||
|
||||
|
@ -435,10 +435,10 @@ typedef struct MenuLayer {
|
|||
//! will be selected initially.
|
||||
//! The layer is marked dirty automatically.
|
||||
//! @param menu_layer The \ref MenuLayer to initialize
|
||||
//! @param frame The frame with which to initialze the \ref MenuLayer
|
||||
//! @param frame The frame with which to initialize the \ref MenuLayer
|
||||
void menu_layer_init(MenuLayer *menu_layer, const GRect *frame);
|
||||
|
||||
//! Creates a new \ref MenuLayer on the heap and initalizes it with the default values.
|
||||
//! Creates a new \ref MenuLayer on the heap and initializes it with the default values.
|
||||
//!
|
||||
//! * Clips: `true`
|
||||
//! * Hidden: `false`
|
||||
|
@ -560,7 +560,7 @@ void menu_layer_set_selected_next(MenuLayer *menu_layer,
|
|||
//! @param scroll_align The alignment of the new selection
|
||||
//! @param animated Supply `true` to animate changing the selection, or `false`
|
||||
//! to change the selection instantly.
|
||||
//! @note If the section and/or row index exceeds the avaible number of sections
|
||||
//! @note If the section and/or row index exceeds the available number of sections
|
||||
//! or resp. rows, the exceeding index/indices will be capped, effectively
|
||||
//! selecting the last section and/or row, resp.
|
||||
void menu_layer_set_selected_index(MenuLayer *menu_layer,
|
||||
|
|
|
@ -283,12 +283,12 @@ static ALWAYS_INLINE GRect prv_menu_cell_basic_draw_custom_one_column_round(
|
|||
|
||||
const bool can_use_two_lines_for_title = !(render_subtitle || render_icon);
|
||||
const bool can_use_many_lines_for_title = (config->overflow_mode == GTextOverflowModeWordWrap);
|
||||
const int16_t intitial_title_text_lines = can_use_two_lines_for_title ? 2 : 1;
|
||||
const int16_t initial_title_text_lines = can_use_two_lines_for_title ? 2 : 1;
|
||||
int16_t title_text_frame_height = can_use_many_lines_for_title
|
||||
? graphics_text_layout_get_text_height(ctx, config->title, title_font,
|
||||
cell_layer_bounds_size.w, config->overflow_mode,
|
||||
text_alignment)
|
||||
: title_font_height * intitial_title_text_lines;
|
||||
: title_font_height * initial_title_text_lines;
|
||||
const int title_text_cap_offset = (config->title) ? fonts_get_font_cap_offset(title_font) : 0;
|
||||
|
||||
int16_t container_height = title_text_frame_height + subtitle_text_frame_height;
|
||||
|
|
|
@ -110,7 +110,7 @@ void prv_update_proc(Layer *layer, GContext* ctx) {
|
|||
graphics_context_set_fill_color(ctx, GColorWhite);
|
||||
graphics_fill_rect(ctx, &layer->bounds);
|
||||
|
||||
// This is safe becase Layer is the first member in Window and Window is the first member in
|
||||
// This is safe because Layer is the first member in Window and Window is the first member in
|
||||
// NumberWindow.
|
||||
_Static_assert(offsetof(Window, layer) == 0, "");
|
||||
_Static_assert(offsetof(NumberWindow, window) == 0, "");
|
||||
|
|
|
@ -89,7 +89,7 @@ typedef struct NumberWindow {
|
|||
//! See code fragment here: NumberWindow
|
||||
void number_window_init(NumberWindow *numberwindow, const char *label, NumberWindowCallbacks callbacks, void *callback_context);
|
||||
|
||||
//! Creates a new NumberWindow on the heap and initalizes it with the default values.
|
||||
//! Creates a new NumberWindow on the heap and initializes it with the default values.
|
||||
//!
|
||||
//! @param label The title or prompt to display in the NumberWindow. Must be long-lived and cannot be stack-allocated.
|
||||
//! @param callbacks The callbacks
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
//!
|
||||
//! A UI component that is a window that contains a progress bar. The state of the progress bar
|
||||
//! is updated using progress_window_set_progress. When the window is first pushed, the progress
|
||||
//! bar will fill on it's own, faking progress until the max_fake_progress_percent threshold is
|
||||
//! bar will fill on its own, faking progress until the max_fake_progress_percent threshold is
|
||||
//! hit. Once the client wishes to indicate success or failure, calling
|
||||
//! progress_window_set_progress_success or progress_window_set_progress_failure will cause the
|
||||
//! UI to animate out to indicate the result, followed by calling the .finished callback if
|
||||
|
@ -107,7 +107,7 @@ void progress_window_set_max_fake_progress(ProgressWindow *window,
|
|||
|
||||
//! Update the progress to a given percentage. This will stop any further fake progress being shown
|
||||
//! the first time this is called. Note that setting progress to 100 is not the same as calling
|
||||
//! one of the progress_windw_set_result_* methods.
|
||||
//! one of the progress_window_set_result_* methods.
|
||||
void progress_window_set_progress(ProgressWindow *window, int16_t progress);
|
||||
|
||||
//! Tell the ProgressWindow it should animate in a way to show success. When the animation is
|
||||
|
|
|
@ -61,7 +61,7 @@ static inline PropertyAnimationPrivate *prv_find_property_animation(PropertyAnim
|
|||
void property_animation_update_int16(PropertyAnimation *property_animation_h,
|
||||
const uint32_t distance_normalized) {
|
||||
if (animation_private_using_legacy_2(NULL)) {
|
||||
// We need to enable other applib modules like sroll_layer, menu_layer, etc. which are
|
||||
// We need to enable other applib modules like scroll_layer, menu_layer, etc. which are
|
||||
// compiled to use the 3.0 animation API to work with 2.0 apps.
|
||||
property_animation_legacy2_update_int16((PropertyAnimationLegacy2 *)property_animation_h,
|
||||
distance_normalized);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
//! @addtogroup Animation
|
||||
//! @{
|
||||
//! @addtogroup PropertyAnimation
|
||||
//! \brief A ProperyAnimation animates the value of a "property" of a "subject" over time.
|
||||
//! \brief A PropertyAnimation animates the value of a "property" of a "subject" over time.
|
||||
//!
|
||||
//! <h3>Animating a Layer's frame property</h3>
|
||||
//! Currently there is only one specific type of property animation offered off-the-shelf, namely
|
||||
|
@ -57,7 +57,7 @@
|
|||
//! Any setter needs to have to following function signature: `void setter(void *subject,
|
||||
//! __type__ value);`
|
||||
//! See \ref Int16Getter, \ref Int16Setter, \ref GPointGetter, \ref GPointSetter,
|
||||
//! \ref GRectGetter, \ref GRectSetter for the typedefs that accompany the update fuctions.
|
||||
//! \ref GRectGetter, \ref GRectSetter for the typedefs that accompany the update functions.
|
||||
//!
|
||||
//! \code{.c}
|
||||
//! static const PropertyAnimationImplementation my_implementation = {
|
||||
|
@ -534,7 +534,7 @@ bool property_animation_to(PropertyAnimation *property_animation, void *to, size
|
|||
// Implementing custom Property Animations
|
||||
//
|
||||
|
||||
//! Creates a new PropertyAnimation on the heap and and initializes it with the specified values.
|
||||
//! Creates a new PropertyAnimation on the heap and initializes it with the specified values.
|
||||
//! The same defaults are used as with \ref animation_create().
|
||||
//! If the `from_value` or the `to_value` is `NULL`, the getter accessor will be called to get the
|
||||
//! current value of the property and be used instead.
|
||||
|
|
|
@ -65,7 +65,7 @@ void rotbmp_pair_layer_set_src_ic(RotBmpPairLayer *pair, GPoint ic) {
|
|||
pair->white_layer.layer.bounds.size });
|
||||
}
|
||||
|
||||
void rotbmp_pair_layer_inver_colors(RotBmpPairLayer *pair) {
|
||||
void rotbmp_pair_layer_invert_colors(RotBmpPairLayer *pair) {
|
||||
RotBitmapLayer temp = pair->black_layer;
|
||||
pair->black_layer = pair->white_layer;
|
||||
pair->white_layer = temp;
|
||||
|
|
|
@ -32,7 +32,7 @@ typedef struct {
|
|||
|
||||
} RotBmpPairLayer;
|
||||
|
||||
//! white and black *must* have the same dimensions, and *shouldn't* have any overlapp of eachother
|
||||
//! white and black *must* have the same dimensions, and *shouldn't* have any overlap of each other
|
||||
void rotbmp_pair_layer_init(RotBmpPairLayer *pair, GBitmap *white, GBitmap *black);
|
||||
|
||||
void rotbmp_pair_layer_deinit(RotBmpPairLayer *pair);
|
||||
|
@ -43,4 +43,4 @@ void rotbmp_pair_layer_increment_angle(RotBmpPairLayer *pair, int32_t angle_chan
|
|||
void rotbmp_pair_layer_set_src_ic(RotBmpPairLayer *pair, GPoint ic);
|
||||
|
||||
//! exchanges black with white
|
||||
void rotbmp_pair_layer_inver_colors(RotBmpPairLayer *pair);
|
||||
void rotbmp_pair_layer_invert_colors(RotBmpPairLayer *pair);
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
//! UP and DOWN buttons with scrolling up and down.
|
||||
//! * The SELECT button can be configured by installing a click configuration
|
||||
//! provider using \ref scroll_layer_set_callbacks().
|
||||
//! * To scroll programatically to a certain offset, use
|
||||
//! * To scroll programmatically to a certain offset, use
|
||||
//! \ref scroll_layer_set_content_offset().
|
||||
//! * It is possible to get called back for each scrolling increment, by
|
||||
//! installing the `.content_offset_changed_handler` callback using
|
||||
|
@ -76,7 +76,7 @@ typedef struct ScrollLayerCallbacks {
|
|||
//! scrolling behavior.
|
||||
ClickConfigProvider click_config_provider;
|
||||
|
||||
//! Called every time the the content offset changes. During a scrolling
|
||||
//! Called every time the content offset changes. During a scrolling
|
||||
//! animation, it will be called for each intermediary offset as well
|
||||
ScrollLayerCallback content_offset_changed_handler;
|
||||
|
||||
|
@ -156,10 +156,10 @@ _Static_assert(offsetof(struct ScrollPaging, flags) == offsetof(Layer, flags),
|
|||
//! * Callback context: `NULL`
|
||||
//! The layer is marked dirty automatically.
|
||||
//! @param scroll_layer The ScrollLayer to initialize
|
||||
//! @param frame The frame with which to initialze the ScrollLayer
|
||||
//! @param frame The frame with which to initialize the ScrollLayer
|
||||
void scroll_layer_init(ScrollLayer *scroll_layer, const GRect *frame);
|
||||
|
||||
//! Creates a new ScrollLayer on the heap and initalizes it with the default values:
|
||||
//! Creates a new ScrollLayer on the heap and initializes it with the default values:
|
||||
//! * Clips: `true`
|
||||
//! * Hidden: `false`
|
||||
//! * Content size: `frame.size`
|
||||
|
|
|
@ -228,7 +228,7 @@ static void prv_draw_slider_slide(SelectionLayer *selection_layer, GContext *ctx
|
|||
|
||||
// It then morphs to the size of the next cell + padding causing the illusion that the selector
|
||||
// overshoot it's mark (it will settle back to the correct size in a different animation).
|
||||
// This means the the width change is the width difference between the two cells plus padding
|
||||
// This means the width change is the width difference between the two cells plus padding
|
||||
int total_cell_width_change = next_cell_width - cur_cell_width + selection_layer->cell_padding;
|
||||
|
||||
// The current width change depends on how far we are through the animation
|
||||
|
@ -293,7 +293,7 @@ static void prv_draw_text(SelectionLayer *selection_layer, GContext *ctx) {
|
|||
height += prv_get_pixels_for_bump_settle(selection_layer->bump_settle_anim_progress);
|
||||
}
|
||||
// The text should be be vertically centered, unless we are performing an increment /
|
||||
// decrment animation.
|
||||
// decrement animation.
|
||||
int y_offset =
|
||||
prv_get_y_offset_which_vertically_centers_font(selection_layer->font, height);
|
||||
|
||||
|
@ -341,7 +341,7 @@ static void prv_draw_selection_layer(SelectionLayer *selection_layer, GContext *
|
|||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//! Increment / Decrement Animation
|
||||
|
||||
//! This animation causes a the active cell to "bump" when the user presses the up button.
|
||||
//! This animation causes the active cell to "bump" when the user presses the up button.
|
||||
//! This animation has two parts:
|
||||
//! 1) The "text to cell edge"
|
||||
//! 2) The "background settle"
|
||||
|
|
|
@ -48,7 +48,7 @@ typedef struct SelectionLayer {
|
|||
unsigned cell_padding;
|
||||
unsigned selected_cell_idx;
|
||||
|
||||
// If is_active = false the the selected cell will become invalid, and any clicks will be ignored
|
||||
// If is_active = false the selected cell will become invalid, and any clicks will be ignored
|
||||
bool is_active;
|
||||
|
||||
GFont font;
|
||||
|
|
|
@ -71,7 +71,7 @@ typedef struct TextLayer {
|
|||
//!
|
||||
//! The text layer is automatically marked dirty after this operation.
|
||||
//! @param text_layer The TextLayer to initialize
|
||||
//! @param frame The frame with which to initialze the TextLayer
|
||||
//! @param frame The frame with which to initialize the TextLayer
|
||||
void text_layer_init(TextLayer *text_layer, const GRect *frame);
|
||||
|
||||
//! Creates a new TextLayer on the heap and initializes it with the default values.
|
||||
|
@ -85,7 +85,7 @@ void text_layer_init(TextLayer *text_layer, const GRect *frame);
|
|||
//! * Caching: `false`
|
||||
//!
|
||||
//! The text layer is automatically marked dirty after this operation.
|
||||
//! @param frame The frame with which to initialze the TextLayer
|
||||
//! @param frame The frame with which to initialize the TextLayer
|
||||
//! @return A pointer to the TextLayer. `NULL` if the TextLayer could not
|
||||
//! be created
|
||||
TextLayer* text_layer_create(GRect frame);
|
||||
|
@ -158,7 +158,7 @@ void text_layer_set_text_alignment(TextLayer *text_layer, GTextAlignment text_al
|
|||
//! By default, layout caching is off (false). Layout caches store the max used
|
||||
//! height and width of a text layer.
|
||||
//! NOTE: when using cached layouts, text_layer_deinit() MUST be called at some
|
||||
//! point in time to prevent memory leaks from occuring.
|
||||
//! point in time to prevent memory leaks from occurring.
|
||||
void text_layer_set_should_cache_layout(TextLayer *text_layer, bool should_cache_layout);
|
||||
|
||||
//! @internal
|
||||
|
|
|
@ -178,7 +178,7 @@ typedef struct Window {
|
|||
//! @param debug_name The window's debug name
|
||||
void window_init(Window *window, const char* debug_name);
|
||||
|
||||
//! Creates a new Window on the heap and initalizes it with the default values.
|
||||
//! Creates a new Window on the heap and initializes it with the default values.
|
||||
//!
|
||||
//! * Background color : `GColorWhite`
|
||||
//! * Root layer's `update_proc` : function that fills the window's background using `background_color`.
|
||||
|
@ -328,14 +328,14 @@ struct Layer* window_get_root_layer(const Window *window);
|
|||
void window_set_background_color(Window *window, GColor background_color);
|
||||
void window_set_background_color_2bit(Window *window, GColor2 background_color);
|
||||
|
||||
//! Sets whether or not the window is fullscreen, consequently hiding the sytem status bar.
|
||||
//! Sets whether or not the window is fullscreen, consequently hiding the system status bar.
|
||||
//! @note This needs to be called before pushing a window to the window stack.
|
||||
//! @param window The window for which to set its full-screen property
|
||||
//! @param enabled True to make the window full-screen or false to leave space for the system status bar.
|
||||
//! @see \ref window_get_fullscreen()
|
||||
void window_set_fullscreen(Window *window, bool enabled);
|
||||
|
||||
//! Gets whether the window is full-screen, consequently hiding the sytem status bar.
|
||||
//! Gets whether the window is full-screen, consequently hiding the system status bar.
|
||||
//! @param window The window for which to get its full-screen property
|
||||
//! @return True if the window is marked as fullscreen, false if it is not marked as fullscreen.
|
||||
bool window_get_fullscreen(const Window *window);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
#include <stddef.h>
|
||||
|
||||
//! Internal interface for glayer to schedule a render for the window:
|
||||
//! Internal interface for layer to schedule a render for the window:
|
||||
//! @param window Pointer to the window to schedule
|
||||
void window_schedule_render(Window *window);
|
||||
|
||||
|
@ -50,8 +50,8 @@ GRect window_calc_frame(bool fullscreen);
|
|||
bool window_has_status_bar(Window *window);
|
||||
|
||||
//! @param window Pointer to the \ref Window to set
|
||||
//! @param overrides_back_button Boolean indicating if the back button has been overriden
|
||||
//! in the \ref ClickConfigProvidier of the passed \ref Window
|
||||
//! @param overrides_back_button Boolean indicating if the back button has been overridden
|
||||
//! in the \ref ClickConfigProvider of the passed \ref Window
|
||||
void window_set_overrides_back_button(Window *window, bool overrides_back_button);
|
||||
|
||||
//! @internal
|
||||
|
|
|
@ -36,7 +36,7 @@ typedef void (*WindowTransitionImplementationRenderFunc)(WindowTransitioningCont
|
|||
// needs to
|
||||
// create an animation that drives the visible transition
|
||||
// (e.g. by moving context.window_to.layer.frame)
|
||||
// call context.window_from.handlers.disappear and context.window_to.handers.appear et al.
|
||||
// call context.window_from.handlers.disappear and context.window_to.handlers.appear et al.
|
||||
// doesn't need to
|
||||
// restore context.window_from.layer.frame (framework will do that)
|
||||
// if no animation is returned by .create_animation, the windows will be replaced immediately
|
||||
|
|
|
@ -51,7 +51,7 @@ typedef struct {
|
|||
|
||||
// There is a slight delay (lag) between the animation stopping and starting it again. To minimize
|
||||
// this, make the animation contain multiple loops (360 degree rotations) instead of 1.
|
||||
// This means that the the lag occurs once less frequently and is less noticable
|
||||
// This means that the lag occurs once less frequently and is less noticable
|
||||
#define LOOPS_PER_ANIMATION 10
|
||||
#define LOOP_DURATION_MS 1500
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ static void click_handler(ClickRecognizerRef recognizer, Window *window) {
|
|||
}
|
||||
|
||||
/*
|
||||
// Exmple animation parameters:
|
||||
// Example animation parameters:
|
||||
|
||||
// Duration defaults to 250 ms
|
||||
animation_set_duration(animation, 1000);
|
||||
|
|
|
@ -117,7 +117,7 @@ static void config_provider(Window *window) {
|
|||
// See ui/click.h for more information and default values.
|
||||
|
||||
// single click / repeat-on-hold config:
|
||||
window_single_repeating_click_subscribe(BUTTON_ID_SELECT, 1000, (ClickHandler)select_single_click_handler); // "hold-to-repeat" gets overriden if there's a long click handler configured!
|
||||
window_single_repeating_click_subscribe(BUTTON_ID_SELECT, 1000, (ClickHandler)select_single_click_handler); // "hold-to-repeat" gets overridden if there's a long click handler configured!
|
||||
|
||||
// multi click config:
|
||||
window_multi_click_subscribe(BUTTON_ID_SELECT, 2, 10, 0, false, (ClickHandler) select_multi_click_handler);
|
||||
|
@ -126,7 +126,7 @@ static void config_provider(Window *window) {
|
|||
window_long_click_subscribe(BUTTON_ID_SELECT, 700, (ClickHandler) select_long_click_handler, (ClickHandler) select_long_click_release_handler);
|
||||
|
||||
// single click / repeat-on-hold config:
|
||||
window_single_repeating_click_subscribe(BUTTON_ID_UP, 1000, (ClickHandler) select_single_click_handler); // "hold-to-repeat" gets overriden if there's a long click handler configured!
|
||||
window_single_repeating_click_subscribe(BUTTON_ID_UP, 1000, (ClickHandler) select_single_click_handler); // "hold-to-repeat" gets overridden if there's a long click handler configured!
|
||||
|
||||
// multi click config:
|
||||
window_multi_click_subscribe(BUTTON_ID_UP, 2, 10, 0, true, (ClickHandler) select_multi_click_handler);
|
||||
|
|
|
@ -179,7 +179,7 @@ void flash_test_dismiss_window(void) {
|
|||
window_stack_remove(&data->test_window, animated);
|
||||
}
|
||||
|
||||
static void up_click_handler(ClickRecognizerRef recognizer, void *unusued) {
|
||||
static void up_click_handler(ClickRecognizerRef recognizer, void *unused) {
|
||||
struct FlashTestData *data = app_state_get_user_data();
|
||||
|
||||
if (data->test_case_status != FLASH_TEST_STATUS_RUNNING) {
|
||||
|
@ -187,7 +187,7 @@ static void up_click_handler(ClickRecognizerRef recognizer, void *unusued) {
|
|||
}
|
||||
}
|
||||
|
||||
static void down_click_handler(ClickRecognizerRef recognizer, void *unusued) {
|
||||
static void down_click_handler(ClickRecognizerRef recognizer, void *unused) {
|
||||
struct FlashTestData *data = app_state_get_user_data();
|
||||
|
||||
// Only stop stress test
|
||||
|
@ -216,7 +216,7 @@ static void run_test(void* context) {
|
|||
update_test_case_status(data);
|
||||
}
|
||||
|
||||
static void select_click_handler(ClickRecognizerRef recognizer, void *unusued) {
|
||||
static void select_click_handler(ClickRecognizerRef recognizer, void *unused) {
|
||||
struct FlashTestData *data = app_state_get_user_data();
|
||||
|
||||
if ((data->test_case == FLASH_TEST_CASE_RUN_STRESS_ADDR_TEST) && (data->test_case_status == FLASH_TEST_STATUS_RUNNING)) {
|
||||
|
|
|
@ -164,7 +164,7 @@ static void prv_window_update_proc(struct Layer *layer, GContext *ctx) {
|
|||
data->rendered_frames++;
|
||||
}
|
||||
|
||||
static void prv_window_disapper(Window *window) {
|
||||
static void prv_window_disappear(Window *window) {
|
||||
}
|
||||
|
||||
void prv_syncing_content_offset_changed(struct ScrollLayer *scroll_layer, void *context) {
|
||||
|
@ -183,7 +183,7 @@ static void prv_window_load(Window *window) {
|
|||
// one image at the top left .topleft_layer,
|
||||
// and two menu layers .action_list1 and .action_list2 that overlay each other
|
||||
|
||||
// some hackery with the two menu layers goes on to keep their scroll offest in sync
|
||||
// some hackery with the two menu layers goes on to keep their scroll offset in sync
|
||||
// and to have the inverter layer rendered only once
|
||||
|
||||
const int16_t navbar_width = s_fps_topleft_bitmap.bounds.size.w;
|
||||
|
@ -256,7 +256,7 @@ static void s_main(void) {
|
|||
window_set_window_handlers(window, &(WindowHandlers) {
|
||||
.load = prv_window_load,
|
||||
.unload = prv_window_unload,
|
||||
.disappear = prv_window_disapper,
|
||||
.disappear = prv_window_disappear,
|
||||
});
|
||||
|
||||
app_window_stack_push(window, true);
|
||||
|
|
|
@ -229,7 +229,7 @@ static void set_text_layers(AppData *data) {
|
|||
} else if (data->alpha == ALPHA_66) {
|
||||
alpha_percent = 50; // FIXME: Currently don't support 66
|
||||
} else if (data->alpha == ALPHA_33) {
|
||||
alpha_percent = 25; // FIXME: Currenlty don't support 33
|
||||
alpha_percent = 25; // FIXME: Currently don't support 33
|
||||
} else if (data->alpha == ALPHA_0) {
|
||||
alpha_percent = 0;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ static void prv_handle_click(ClickRecognizerRef ref, void *context) {
|
|||
app_window_stack_push(window, true);
|
||||
}
|
||||
|
||||
static void prv_click_config_proivider(void *context) {
|
||||
static void prv_click_config_provider(void *context) {
|
||||
window_single_click_subscribe(BUTTON_ID_SELECT, prv_handle_click);
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ static Window *prv_window_create(void) {
|
|||
layer_add_child(&window->window.layer, &status_bar->layer);
|
||||
}
|
||||
|
||||
window_set_click_config_provider(result, prv_click_config_proivider);
|
||||
window_set_click_config_provider(result, prv_click_config_provider);
|
||||
|
||||
window_set_window_handlers(&window->window, &(WindowHandlers){
|
||||
.unload = prv_window_unload,
|
||||
|
|
|
@ -286,8 +286,8 @@ static void canvas_update_proc(Layer *layer, GContext* ctx) {
|
|||
uint16_t now_ms = time_ms(&now, NULL);
|
||||
|
||||
uint32_t seconds = pbl_override_localtime(&now)->tm_sec;
|
||||
uint32_t miliseconds = seconds * 1000 + now_ms;
|
||||
uint32_t rotation = miliseconds * TRIG_MAX_ANGLE / (60 * 1000);
|
||||
uint32_t milliseconds = seconds * 1000 + now_ms;
|
||||
uint32_t rotation = milliseconds * TRIG_MAX_ANGLE / (60 * 1000);
|
||||
|
||||
GPointPrecise p0;
|
||||
GPointPrecise p1;
|
||||
|
@ -317,8 +317,8 @@ static void canvas_update_proc(Layer *layer, GContext* ctx) {
|
|||
uint16_t now_ms = time_ms(&now, NULL);
|
||||
|
||||
uint32_t seconds = pbl_override_localtime(&now)->tm_sec;
|
||||
uint32_t miliseconds = seconds * 1000 + now_ms;
|
||||
uint32_t rotation = miliseconds * TRIG_MAX_ANGLE / (60 * 1000);
|
||||
uint32_t milliseconds = seconds * 1000 + now_ms;
|
||||
uint32_t rotation = milliseconds * TRIG_MAX_ANGLE / (60 * 1000);
|
||||
|
||||
GPointPrecise p0;
|
||||
GPointPrecise p1;
|
||||
|
|
|
@ -57,7 +57,7 @@ static void prv_verify_modify_on_app_task(void *data) {
|
|||
if (app_data->test != 0x3C3C3C3C) {
|
||||
text_layer_set_text(&app_data->text, "FAILED");
|
||||
} else {
|
||||
text_layer_set_text(&app_data->text, "PASSSED");
|
||||
text_layer_set_text(&app_data->text, "PASSED");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -315,7 +315,7 @@ void stuck_callback_menu_cb(int index, void *ctx) {
|
|||
}
|
||||
|
||||
// =================================================================================
|
||||
void invaid_timer_id_menu_cb(int index, void *ctx) {
|
||||
void invalid_timer_id_menu_cb(int index, void *ctx) {
|
||||
void *cb_data = 0;
|
||||
uint32_t zero_flags = 0;
|
||||
|
||||
|
@ -405,7 +405,7 @@ static void prv_window_load(Window *window) {
|
|||
.callback = stuck_callback_menu_cb
|
||||
}, {
|
||||
.title = "invalid timer ID",
|
||||
.callback = invaid_timer_id_menu_cb
|
||||
.callback = invalid_timer_id_menu_cb
|
||||
}, {
|
||||
.title = "RT: sch 1 sec from cb",
|
||||
.callback = reg_timer_schedule_1sec_from_cb_menu_cb
|
||||
|
|
|
@ -71,7 +71,7 @@ static void prv_add_notification(int32_t delta_time_s) {
|
|||
"Angela Tam", "Liron Damir", "Heiko Behrens", "Kevin Conley", "Matt Hungerford",
|
||||
};
|
||||
char *bodies[] = {
|
||||
"Late again? Can you be on time ever? Seriosly? Dude!!!",
|
||||
"Late again? Can you be on time ever? Seriously? Dude!!!",
|
||||
"Late again. Sorry, I'll be there a few minutes. Meanwhile, I am just texting long messages.",
|
||||
"What's up for lunch?",
|
||||
"\xF0\x9F\x98\x83 \xF0\x9F\x92\xA9",
|
||||
|
|
|
@ -155,7 +155,7 @@ static void prv_txrx_menu_update(AppData *data);
|
|||
// and use that to know how to proceed through.
|
||||
//
|
||||
// A BTLE test gets started, and needs to be manually stopped.
|
||||
// This means that setup setup goes like this:
|
||||
// This means that setup goes like this:
|
||||
//
|
||||
// 1. User Signals "RUN"
|
||||
// 2. bt_test_start()
|
||||
|
@ -174,7 +174,7 @@ static void prv_response_cb(HciStatusCode status, const uint8_t *payload) {
|
|||
// RX Test, need to keep track of received packets
|
||||
// Payload is as follows:
|
||||
// | 1 byte | 2 bytes |
|
||||
// | success | recieved packets |
|
||||
// | success | received packets |
|
||||
// So we want grab a uint16_t from 1 byte into the payload
|
||||
const uint16_t *received_packets = (uint16_t *)(payload + 1);
|
||||
data->rx_test_received_packets = *received_packets;
|
||||
|
@ -459,7 +459,7 @@ static void prv_status_window_init(AppData *data) {
|
|||
//--------------------------------------------------------------------------------
|
||||
// TX/RX Menus & Windows
|
||||
//--------------------------------------------------------------------------------
|
||||
// The same menu layer is reused for TX / RX, we just handle it differentely
|
||||
// The same menu layer is reused for TX / RX, we just handle it differently
|
||||
// based on whether we are currently executing a TX or RX test.
|
||||
|
||||
#define TX_MENU_NUM_PAYLOAD_ROWS (2)
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
//! The reason it's not just a boring set of long click handlers is because we don't support
|
||||
//! registering a long click handler for a combination of buttons like up+down.
|
||||
//!
|
||||
//! I tried to split this out from a seperate file from the recovery_first_use.c file so I could
|
||||
//! test this behaviour in a unit test independant in the UI. I think it turned out /okay/. The
|
||||
//! I tried to split this out from a separate file from the recovery_first_use.c file so I could
|
||||
//! test this behaviour in a unit test independent in the UI. I think it turned out /okay/. The
|
||||
//! callback specification is a little odd (only for select but not for the other ones, should we
|
||||
//! be blowing memory on static behaviour like this?) but it was worth a shot.
|
||||
|
||||
|
@ -46,7 +46,7 @@ typedef struct {
|
|||
|
||||
//! Timer for how long the combination has been held for. We use new_timer instead of app_timer
|
||||
//! even though it's a little more dangerous (doesn't automatically get cleaned up by the app)
|
||||
//! because the api is nicer for starting/stopping/resceduling the same timer over and over
|
||||
//! because the api is nicer for starting/stopping/rescheduling the same timer over and over
|
||||
//! again with different callbacks.
|
||||
TimerID combo_timer;
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ static void prv_app_fetch_launch_app(AppFetchUIData *data) {
|
|||
vibes_short_pulse();
|
||||
}
|
||||
|
||||
// Allocate and inialize the data that would have been sent to the app originally before the
|
||||
// Allocate and initialize the data that would have been sent to the app originally before the
|
||||
// fetch request.
|
||||
PebbleLaunchAppEventExtended *ext = kernel_malloc_check(sizeof(PebbleLaunchAppEventExtended));
|
||||
*ext = (PebbleLaunchAppEventExtended) {
|
||||
|
|
|
@ -87,7 +87,7 @@ static void prv_health_service_event_handler(HealthEventType event, void *contex
|
|||
//
|
||||
|
||||
//! Initialize application
|
||||
static void prv_finish_initilization_cb(bool in_focus) {
|
||||
static void prv_finish_initialization_cb(bool in_focus) {
|
||||
if (in_focus) {
|
||||
HealthAppData *health_app_data = app_state_get_user_data();
|
||||
|
||||
|
@ -128,7 +128,7 @@ static void prv_initialize(void) {
|
|||
|
||||
// Finish up initializing the app a bit later. This helps reduce lag when opening the app
|
||||
app_focus_service_subscribe_handlers((AppFocusHandlers){
|
||||
.did_focus = prv_finish_initilization_cb,
|
||||
.did_focus = prv_finish_initialization_cb,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include "health_progress.h"
|
||||
|
||||
//! 5 main segments + 2 real corners + 2 endcaps implemented as corners (for bw)
|
||||
//! Each of the 5 non-corener segments get 20% of the total
|
||||
//! Each of the 5 non-corner segments get 20% of the total
|
||||
#define AMOUNT_PER_SEGMENT (HEALTH_PROGRESS_BAR_MAX_VALUE * 20 / 100)
|
||||
|
||||
// Found through trial and error
|
||||
|
|
|
@ -103,7 +103,7 @@ static int prv_get_next_card_idx(Card current, bool up) {
|
|||
if (next == Card_HrSummary && !activity_is_hrm_present()) {
|
||||
next = next + direction;
|
||||
}
|
||||
// if heart rate is diabled, change the order of cards to Activiy <-> Sleep <-> HR
|
||||
// if heart rate is disabled, change the order of cards to Activity <-> Sleep <-> HR
|
||||
else if (activity_is_hrm_present() && !activity_prefs_heart_rate_is_enabled()) {
|
||||
if (current == Card_ActivitySummary) {
|
||||
next = up ? Card_SleepSummary : BACK_TO_WATCHFACE;
|
||||
|
|
|
@ -60,7 +60,7 @@ void health_data_update_step_derived_metrics(HealthData *health_data);
|
|||
|
||||
//! Update the number of steps the user has taken today
|
||||
//! @param health_data A pointer to the health data to use
|
||||
//! @param new_steps the new value of the steps for toaday
|
||||
//! @param new_steps the new value of the steps for today
|
||||
void health_data_update_steps(HealthData *health_data, uint32_t new_steps);
|
||||
|
||||
//! Update the number of seconds the user has slept today
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
typedef struct HealthData {
|
||||
//!< Current step / activity info
|
||||
int32_t step_data[DAYS_PER_WEEK]; //!< Step histroy for today and the previous 6 days
|
||||
int32_t step_data[DAYS_PER_WEEK]; //!< Step history for today and the previous 6 days
|
||||
int32_t current_distance_meters;
|
||||
int32_t current_calories;
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ static void prv_draw_progress_bar_in_zone(GContext *ctx, const GRect *zone_rect,
|
|||
|
||||
HealthProgressSegment segments[] = {
|
||||
{
|
||||
// Left side vertical line (needed for the draw outline function to draw the verticle lines)
|
||||
// Left side vertical line (needed for the draw outline function to draw the vertical lines)
|
||||
.type = HealthProgressSegmentType_Corner,
|
||||
.points = {
|
||||
{progress_bar_x, progress_bar_y},
|
||||
|
@ -185,7 +185,7 @@ static void prv_draw_progress_bar_in_zone(GContext *ctx, const GRect *zone_rect,
|
|||
},
|
||||
},
|
||||
{
|
||||
// Right side vertical line (needed for the draw outline function to draw the verticle lines)
|
||||
// Right side vertical line (needed for the draw outline function to draw the vertical lines)
|
||||
.type = HealthProgressSegmentType_Corner,
|
||||
.points = {
|
||||
{progress_bar_x + progress_bar_width, progress_bar_y},
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue